@compassdigital/sdk.typescript 4.103.0 → 4.105.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compassdigital/sdk.typescript",
3
- "version": "4.103.0",
3
+ "version": "4.105.0",
4
4
  "description": "Compass Digital Labs TypeScript SDK",
5
5
  "type": "commonjs",
6
6
  "main": "./lib/index.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@compassdigital/review": "^7.3.0",
49
- "@compassdigital/sdk.typescript.cli": "^4.30.0",
49
+ "@compassdigital/sdk.typescript.cli": "^4.32.0",
50
50
  "@swc/core": "^1.4.1",
51
51
  "@swc/jest": "^0.2.36",
52
52
  "@types/jest": "^29.2.4",
package/src/base.ts CHANGED
@@ -25,6 +25,8 @@ export interface RequestOptions {
25
25
  // https.Agent agent to use
26
26
  // Note: we use 'any' type to remain browser compatible
27
27
  agent?: any;
28
+ // flag to indicate internal requests
29
+ internal?: boolean;
28
30
  }
29
31
 
30
32
  /**
@@ -484,6 +486,9 @@ export abstract class BaseServiceClient {
484
486
  'Content-Type': 'application/json',
485
487
  ...options.headers,
486
488
  };
489
+ if (options.internal) {
490
+ headers['X-Request-Type'] = 'internal';
491
+ }
487
492
  if (options.token) {
488
493
  headers.Authorization = `Bearer ${options.token}`;
489
494
  }
package/src/index.ts CHANGED
@@ -1144,16 +1144,16 @@ import {
1144
1144
  } from './interface/review';
1145
1145
 
1146
1146
  import {
1147
- PostDiscountBody,
1148
- PostDiscountResponse,
1149
- GetDiscountsQuery,
1150
- GetDiscountsResponse,
1151
1147
  GetDiscountQuery,
1152
1148
  GetDiscountResponse,
1153
1149
  PutDiscountBody,
1154
1150
  PutDiscountResponse,
1155
1151
  DeleteDiscountBody,
1156
1152
  DeleteDiscountResponse,
1153
+ GetDiscountsQuery,
1154
+ GetDiscountsResponse,
1155
+ PostDiscountBody,
1156
+ PostDiscountResponse,
1157
1157
  PutDiscountPublishBody,
1158
1158
  PutDiscountPublishResponse,
1159
1159
  } from './interface/discount';
@@ -11768,32 +11768,6 @@ export class ServiceClient extends BaseServiceClient {
11768
11768
  return this.request('review', '/review/{id}', 'get', `/review/${id}`, null, options);
11769
11769
  }
11770
11770
 
11771
- /**
11772
- * POST /discount - Post a discount
11773
- *
11774
- * @param body
11775
- * @param options - additional request options
11776
- */
11777
- post_discount(
11778
- body: PostDiscountBody,
11779
- options?: RequestOptions,
11780
- ): ResponsePromise<PostDiscountResponse> {
11781
- return this.request('discount', '/discount', 'post', `/discount`, body, options);
11782
- }
11783
-
11784
- /**
11785
- * GET /discount - Get discounts by taxonomy
11786
- *
11787
- * @param options - additional request options
11788
- */
11789
- get_discounts(
11790
- options: {
11791
- query: GetDiscountsQuery;
11792
- } & RequestOptions,
11793
- ): ResponsePromise<GetDiscountsResponse> {
11794
- return this.request('discount', '/discount', 'get', `/discount`, null, options);
11795
- }
11796
-
11797
11771
  /**
11798
11772
  * GET /discount/{id} - Get a discount
11799
11773
  *
@@ -11839,6 +11813,32 @@ export class ServiceClient extends BaseServiceClient {
11839
11813
  return this.request('discount', '/discount/{id}', 'delete', `/discount/${id}`, body, options);
11840
11814
  }
11841
11815
 
11816
+ /**
11817
+ * GET /discount - Get discounts by taxonomy
11818
+ *
11819
+ * @param options - additional request options
11820
+ */
11821
+ get_discounts(
11822
+ options: {
11823
+ query: GetDiscountsQuery;
11824
+ } & RequestOptions,
11825
+ ): ResponsePromise<GetDiscountsResponse> {
11826
+ return this.request('discount', '/discount', 'get', `/discount`, null, options);
11827
+ }
11828
+
11829
+ /**
11830
+ * POST /discount - Post a discount
11831
+ *
11832
+ * @param body
11833
+ * @param options - additional request options
11834
+ */
11835
+ post_discount(
11836
+ body: PostDiscountBody,
11837
+ options?: RequestOptions,
11838
+ ): ResponsePromise<PostDiscountResponse> {
11839
+ return this.request('discount', '/discount', 'post', `/discount`, body, options);
11840
+ }
11841
+
11842
11842
  /**
11843
11843
  * PUT /discount/{id}/publish - update and publish a discount
11844
11844
  *
@@ -24,7 +24,7 @@ export interface AnnouncementPostRequestBody {
24
24
  is_global?: boolean;
25
25
  allowed_resources?: string[];
26
26
  position?: number;
27
- //@deprecated
27
+ // @deprecated
28
28
  active?: boolean;
29
29
  status?: Status;
30
30
  // Announcement Properties
@@ -65,7 +65,7 @@ export interface AnnouncementPatchRequestBody {
65
65
  is_global?: boolean;
66
66
  allowed_resources?: string[];
67
67
  position?: number;
68
- //@deprecated
68
+ // @deprecated
69
69
  active?: boolean;
70
70
  status?: Status;
71
71
  // Announcement Properties
@@ -89,7 +89,7 @@ export interface Announcement {
89
89
  // True if all the sites are linked
90
90
  is_global: boolean;
91
91
  allowed_resources: string[];
92
- //@deprecated
92
+ // @deprecated
93
93
  active: boolean;
94
94
  status?: Status;
95
95
  schedule?: Schedule;
@@ -103,7 +103,7 @@ export interface Announcement {
103
103
  en?: AnnouncementInfo;
104
104
  fr?: AnnouncementInfo;
105
105
  };
106
- //@deprecated
106
+ // @deprecated
107
107
  date?: Record<string, any>;
108
108
  author?: User;
109
109
  edit_history?: EditHistory[];
@@ -5,6 +5,7 @@ import { RequestQuery, BaseRequest } from './util';
5
5
 
6
6
  export interface DiscountStatus {
7
7
  live?: boolean;
8
+ publishedTo3rdParty?: boolean;
8
9
  readyToPublish?: boolean;
9
10
  }
10
11
 
@@ -15,39 +16,6 @@ export interface DiscountIs {
15
16
  voucherPromo?: boolean;
16
17
  }
17
18
 
18
- export interface PostDiscountRequestDTO {
19
- // user is of discount creator
20
- createdBy?: string;
21
- name?: string;
22
- status?: DiscountStatus;
23
- is?: DiscountIs;
24
- app?: string;
25
- }
26
-
27
- export interface PostDiscountResponseDTO {
28
- // user is of discount creator
29
- createdBy?: string;
30
- id: string;
31
- createdAt: string;
32
- updatedAt: string;
33
- name?: string;
34
- status?: DiscountStatus;
35
- is?: DiscountIs;
36
- app?: string;
37
- }
38
-
39
- export interface BadRequestErrorDTO {
40
- message: string;
41
- code: number;
42
- data: Record<string, any>;
43
- }
44
-
45
- export interface UnauthorizedErrorDTO {
46
- message: string;
47
- code: number;
48
- data: Record<string, any>;
49
- }
50
-
51
19
  export interface VoucherifyMetaDataDiscount {
52
20
  type: string;
53
21
  amountOff?: number;
@@ -74,6 +42,7 @@ export interface GetDiscountResponseDTO {
74
42
  id: string;
75
43
  createdAt: string;
76
44
  updatedAt: string;
45
+ updatedBy?: string;
77
46
  name?: string;
78
47
  status?: DiscountStatus;
79
48
  is?: DiscountIs;
@@ -81,6 +50,12 @@ export interface GetDiscountResponseDTO {
81
50
  meta?: DiscountMeta;
82
51
  }
83
52
 
53
+ export interface UnauthorizedErrorDTO {
54
+ message: string;
55
+ code: number;
56
+ data: Record<string, any>;
57
+ }
58
+
84
59
  export interface NotFoundErrorDTO {
85
60
  message: string;
86
61
  code: number;
@@ -93,6 +68,7 @@ export interface DiscountDTO {
93
68
  id: string;
94
69
  createdAt: string;
95
70
  updatedAt: string;
71
+ updatedBy?: string;
96
72
  name?: string;
97
73
  status?: DiscountStatus;
98
74
  is?: DiscountIs;
@@ -104,9 +80,30 @@ export interface GetDiscountsResponseDTO {
104
80
  discounts: DiscountDTO[];
105
81
  }
106
82
 
83
+ export interface BadRequestErrorDTO {
84
+ message: string;
85
+ code: number;
86
+ data: Record<string, any>;
87
+ }
88
+
89
+ export interface PostDiscountRequestDTO {
90
+ createdBy: string;
91
+ name: string;
92
+ app: string;
93
+ }
94
+
95
+ export interface PostDiscountResponseDTO {
96
+ createdBy: string;
97
+ name: string;
98
+ app: string;
99
+ id: string;
100
+ createdAt: string;
101
+ updatedAt: string;
102
+ }
103
+
107
104
  export interface PutDiscountRequestDTO {
108
105
  taxonomy?: Record<string, any>;
109
- id: string;
106
+ updatedBy?: string;
110
107
  name?: string;
111
108
  status?: DiscountStatus;
112
109
  is?: DiscountIs;
@@ -120,6 +117,7 @@ export interface PutDiscountResponseDTO {
120
117
  id: string;
121
118
  createdAt: string;
122
119
  updatedAt: string;
120
+ updatedBy?: string;
123
121
  name?: string;
124
122
  status?: DiscountStatus;
125
123
  is?: DiscountIs;
@@ -131,7 +129,7 @@ export type InternalServerErrorException = Record<string, any>;
131
129
 
132
130
  export interface PutDiscountPublishRequestDTO {
133
131
  taxonomy?: Record<string, any>;
134
- id: string;
132
+ updatedBy?: string;
135
133
  name?: string;
136
134
  status?: DiscountStatus;
137
135
  is?: DiscountIs;
@@ -145,6 +143,7 @@ export interface PutDiscountPublishResponseDTO {
145
143
  id: string;
146
144
  createdAt: string;
147
145
  updatedAt: string;
146
+ updatedBy?: string;
148
147
  name?: string;
149
148
  status?: DiscountStatus;
150
149
  is?: DiscountIs;
@@ -162,29 +161,6 @@ export interface DeleteDiscountResponseDTO {
162
161
  success: boolean;
163
162
  }
164
163
 
165
- // POST /discount - Post a discount
166
-
167
- export type PostDiscountBody = PostDiscountRequestDTO;
168
-
169
- export type PostDiscountResponse = PostDiscountResponseDTO;
170
-
171
- export interface PostDiscountRequest extends BaseRequest {
172
- body: PostDiscountBody;
173
- }
174
-
175
- // GET /discount - Get discounts by taxonomy
176
-
177
- export interface GetDiscountsQuery {
178
- taxonomyFilter: string;
179
- active: boolean;
180
- // Graphql query string
181
- _query?: string;
182
- }
183
-
184
- export type GetDiscountsResponse = GetDiscountsResponseDTO;
185
-
186
- export interface GetDiscountsRequest extends BaseRequest, RequestQuery<GetDiscountsQuery> {}
187
-
188
164
  // GET /discount/{id} - Get a discount
189
165
 
190
166
  export interface GetDiscountPath {
@@ -233,6 +209,29 @@ export interface DeleteDiscountRequest extends BaseRequest, DeleteDiscountPath {
233
209
  body: DeleteDiscountBody;
234
210
  }
235
211
 
212
+ // GET /discount - Get discounts by taxonomy
213
+
214
+ export interface GetDiscountsQuery {
215
+ taxonomyFilter: string;
216
+ active: boolean;
217
+ // Graphql query string
218
+ _query?: string;
219
+ }
220
+
221
+ export type GetDiscountsResponse = GetDiscountsResponseDTO;
222
+
223
+ export interface GetDiscountsRequest extends BaseRequest, RequestQuery<GetDiscountsQuery> {}
224
+
225
+ // POST /discount - Post a discount
226
+
227
+ export type PostDiscountBody = PostDiscountRequestDTO;
228
+
229
+ export type PostDiscountResponse = PostDiscountResponseDTO;
230
+
231
+ export interface PostDiscountRequest extends BaseRequest {
232
+ body: PostDiscountBody;
233
+ }
234
+
236
235
  // PUT /discount/{id}/publish - update and publish a discount
237
236
 
238
237
  export interface PutDiscountPublishPath {
@@ -83,9 +83,9 @@ export interface Brand {
83
83
  };
84
84
  timezone?: string;
85
85
  description?: string;
86
- //@deprecated
86
+ // @deprecated
87
87
  latitude?: number;
88
- //@deprecated
88
+ // @deprecated
89
89
  longitude?: number;
90
90
  address?: Address;
91
91
  menus?: MenuHours[];
@@ -154,7 +154,7 @@ export interface Brand {
154
154
  group?: string;
155
155
  // The CDL id representing the payment provider of this brand
156
156
  payment_provider?: string;
157
- //@deprecated
157
+ // @deprecated
158
158
  location_description?: string;
159
159
  // The CDL id representing the company of this brand
160
160
  company?: string;
@@ -368,7 +368,7 @@ export interface Locations {
368
368
  }
369
369
 
370
370
  export interface Multigroups {
371
- //@deprecated
371
+ // @deprecated
372
372
  groups?: MultiGroup[];
373
373
  multigroups?: MultiGroup[];
374
374
  }
@@ -510,9 +510,9 @@ export interface PostLocationRequest extends BaseRequest {
510
510
  // GET /location/search - Gets Location within a radius of the provided point
511
511
 
512
512
  export interface GetLocationSearchQuery {
513
- //@deprecated
513
+ // @deprecated
514
514
  lat?: number;
515
- //@deprecated
515
+ // @deprecated
516
516
  long?: number;
517
517
  // Operation id to be used
518
518
  operation_id?: number;
@@ -767,7 +767,7 @@ export interface GetLocationGroupQuery {
767
767
  non_market_places?: boolean;
768
768
  // return only groups with non-scan & go locations/brands
769
769
  non_scan_go?: boolean;
770
- //@deprecated
770
+ // @deprecated
771
771
  include_estimated_wait_time?: boolean;
772
772
  // Graphql query string
773
773
  _query?: string;
@@ -171,7 +171,7 @@ export interface PostMealplanCallbackBody {
171
171
 
172
172
  export interface PostMealplanCallbackResponse {
173
173
  token?: string;
174
- //@deprecated
174
+ // @deprecated
175
175
  cardNumber?: string;
176
176
  }
177
177
 
@@ -84,7 +84,7 @@ export interface Item {
84
84
  ingredients?: Record<string, any>[];
85
85
  amount_off_exclusions?: AmountOffExclusionTypes[];
86
86
  nutrition?: {
87
- //@deprecated
87
+ // @deprecated
88
88
  kcal?: number;
89
89
  calories?: Nutrition;
90
90
  serving_size?: Nutrition;
@@ -195,7 +195,7 @@ export interface Item {
195
195
  secondary?: string;
196
196
  };
197
197
  };
198
- //@deprecated
198
+ // @deprecated
199
199
  is_deleted?: boolean;
200
200
  is?: {
201
201
  disabled?: boolean;
@@ -215,7 +215,7 @@ export interface Group {
215
215
  fr?: string;
216
216
  };
217
217
  items?: Item[];
218
- //@deprecated
218
+ // @deprecated
219
219
  is_disabled?: boolean;
220
220
  is?: {
221
221
  disabled?: boolean;
@@ -270,7 +270,7 @@ export interface Option {
270
270
  };
271
271
  sku?: number;
272
272
  nutrition?: {
273
- //@deprecated
273
+ // @deprecated
274
274
  kcal?: number;
275
275
  calories?: Nutrition;
276
276
  };
@@ -28,9 +28,9 @@ export interface CreateOrder {
28
28
  active_override?: boolean;
29
29
  [index: string]: any;
30
30
  };
31
- //@deprecated
31
+ // @deprecated
32
32
  pickup?: string;
33
- //@deprecated
33
+ // @deprecated
34
34
  pickup_name?: string;
35
35
  requested_date?: string;
36
36
  details?: {
@@ -54,7 +54,7 @@ export interface Error {
54
54
  export interface Issue {
55
55
  id?: string;
56
56
  type?: string;
57
- //@deprecated
57
+ // @deprecated
58
58
  item?: Record<string, any>;
59
59
  // Array of Items with issues
60
60
  items?: ItemsWithIssue[];
@@ -134,11 +134,11 @@ export interface Order {
134
134
  // Date order was polled for kds
135
135
  polled?: string;
136
136
  };
137
- //@deprecated
137
+ // @deprecated
138
138
  pickup?: string;
139
- //@deprecated
139
+ // @deprecated
140
140
  pickup_name?: string;
141
- //@deprecated
141
+ // @deprecated
142
142
  pickup_id?: string;
143
143
  requested_date?: string;
144
144
  details?: {
@@ -298,7 +298,7 @@ export interface MealPlan {
298
298
  export interface OrderIssue {
299
299
  // Type of issue
300
300
  type?: string;
301
- //@deprecated
301
+ // @deprecated
302
302
  item?: Record<string, any>;
303
303
  // Array of Items with issues
304
304
  items?: ItemsWithIssue[];
@@ -502,9 +502,9 @@ export interface GetOrderCustomerOrdersPath {
502
502
  export interface GetOrderCustomerOrdersQuery {
503
503
  // Sort the customers order by order created date, pickup date or requested date. Possible values: created, pickup. Default is created.
504
504
  sort?: string;
505
- //@deprecated
505
+ // @deprecated
506
506
  pickup_start?: number;
507
- //@deprecated
507
+ // @deprecated
508
508
  pickup_end?: number;
509
509
  // Filter orders by their requested date. Only return orders that have a date less than or equal to the date. Default is 24 hours from the current time in milliseconds.
510
510
  end?: number;
@@ -558,9 +558,9 @@ export interface GetOrderLocationBrandPath {
558
558
  }
559
559
 
560
560
  export interface GetOrderLocationBrandQuery {
561
- //@deprecated
561
+ // @deprecated
562
562
  pickup_start?: number;
563
- //@deprecated
563
+ // @deprecated
564
564
  pickup_end?: number;
565
565
  // Filter orders to just those with this ready state
566
566
  ready?: boolean;
@@ -595,9 +595,9 @@ export interface GetOrderLocationOrdersPath {
595
595
  }
596
596
 
597
597
  export interface GetOrderLocationOrdersQuery {
598
- //@deprecated
598
+ // @deprecated
599
599
  pickup_start?: number;
600
- //@deprecated
600
+ // @deprecated
601
601
  pickup_end?: number;
602
602
  // Filter orders to just those with this ready state
603
603
  ready?: boolean;
@@ -50,7 +50,7 @@ export interface ShoppingCartResponse {
50
50
  }[];
51
51
  };
52
52
  };
53
- //@deprecated
53
+ // @deprecated
54
54
  loyalty?: {
55
55
  coupon?: {
56
56
  code?: string;
@@ -451,9 +451,9 @@ export interface Brand {
451
451
  };
452
452
  timezone?: string;
453
453
  description?: string;
454
- //@deprecated
454
+ // @deprecated
455
455
  latitude?: number;
456
- //@deprecated
456
+ // @deprecated
457
457
  longitude?: number;
458
458
  address?: Address;
459
459
  menus?: MenuHours[];
@@ -522,7 +522,7 @@ export interface Brand {
522
522
  group?: string;
523
523
  // The CDL id representing the payment provider of this brand
524
524
  payment_provider?: string;
525
- //@deprecated
525
+ // @deprecated
526
526
  location_description?: string;
527
527
  // The CDL id representing the company of this brand
528
528
  company?: string;
@@ -747,7 +747,7 @@ export interface Group {
747
747
  ingredients?: Record<string, any>[];
748
748
  amount_off_exclusions?: AmountOffExclusionTypes[];
749
749
  nutrition?: {
750
- //@deprecated
750
+ // @deprecated
751
751
  kcal?: number;
752
752
  calories?: Nutrition;
753
753
  serving_size?: Nutrition;
@@ -831,7 +831,7 @@ export interface Group {
831
831
  };
832
832
  sku?: number;
833
833
  nutrition?: {
834
- //@deprecated
834
+ // @deprecated
835
835
  kcal?: number;
836
836
  calories?: Nutrition;
837
837
  };
@@ -976,7 +976,7 @@ export interface Group {
976
976
  secondary?: string;
977
977
  };
978
978
  };
979
- //@deprecated
979
+ // @deprecated
980
980
  is_deleted?: boolean;
981
981
  is?: {
982
982
  disabled?: boolean;
@@ -987,7 +987,7 @@ export interface Group {
987
987
  featured?: boolean;
988
988
  };
989
989
  }[];
990
- //@deprecated
990
+ // @deprecated
991
991
  is_disabled?: boolean;
992
992
  is?: {
993
993
  disabled?: boolean;
@@ -314,7 +314,7 @@ export interface ShoppingCartResponse {
314
314
  amount?: MonetaryValue;
315
315
  };
316
316
  promo?: PromoDetails;
317
- //@deprecated
317
+ // @deprecated
318
318
  loyalty?: {
319
319
  coupon?: {
320
320
  code?: string;
@@ -130,7 +130,7 @@ export interface OrderIssue {
130
130
  // issue
131
131
  id?: string;
132
132
  type?: string;
133
- //@deprecated
133
+ // @deprecated
134
134
  item?: Record<string, any>;
135
135
  // Array of Items with issues
136
136
  items?: Record<string, any>[];
@@ -36,7 +36,7 @@ export interface User {
36
36
  locked_out?: boolean;
37
37
  // If the users email is verified
38
38
  verified?: boolean;
39
- //@deprecated
39
+ // @deprecated
40
40
  phone_verified?: boolean;
41
41
  // User deleted status
42
42
  deleted?: boolean;
@@ -98,7 +98,7 @@ export interface success {
98
98
  }
99
99
 
100
100
  export interface auth {
101
- //@deprecated
101
+ // @deprecated
102
102
  token?: string;
103
103
  access?: {
104
104
  token?: string;
@@ -113,7 +113,7 @@ export interface auth {
113
113
  }
114
114
 
115
115
  export interface guestAuth {
116
- //@deprecated
116
+ // @deprecated
117
117
  token?: string;
118
118
  access?: {
119
119
  token?: string;
@@ -141,7 +141,7 @@ export interface omsauth {
141
141
  }
142
142
 
143
143
  export interface guestAuthToken {
144
- //@deprecated
144
+ // @deprecated
145
145
  token?: string;
146
146
  access?: {
147
147
  token?: string;
@@ -304,7 +304,7 @@ export interface UserMeta {
304
304
  attempts?: number;
305
305
  first_attempted?: string;
306
306
  };
307
- //@deprecated
307
+ // @deprecated
308
308
  phone_verification?: {
309
309
  verification_code?: string;
310
310
  date_generated?: number;