@compassdigital/sdk.typescript 4.153.0 → 4.155.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/lib/base.d.ts.map +1 -1
- package/lib/base.js +11 -8
- package/lib/base.js.map +1 -1
- package/lib/index.d.ts +25 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +27 -0
- package/lib/index.js.map +1 -1
- package/lib/interface/consumer.d.ts +17 -0
- package/lib/interface/consumer.d.ts.map +1 -1
- package/lib/interface/location.d.ts +14 -0
- package/lib/interface/location.d.ts.map +1 -1
- package/lib/interface/menu.d.ts +22 -0
- package/lib/interface/menu.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/base.ts +12 -8
- package/src/index.ts +69 -0
- package/src/interface/consumer.ts +21 -0
- package/src/interface/location.ts +25 -0
- package/src/interface/menu.ts +32 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compassdigital/sdk.typescript",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.155.0",
|
|
4
4
|
"description": "Compass Digital Labs TypeScript SDK",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@compassdigital/review": "^7.6.3",
|
|
60
|
-
"@compassdigital/sdk.typescript.cli": "^4.
|
|
60
|
+
"@compassdigital/sdk.typescript.cli": "^4.48.0",
|
|
61
61
|
"@swc/core": "^1.4.1",
|
|
62
62
|
"@swc/jest": "^0.2.36",
|
|
63
63
|
"@types/jest": "^29.2.4",
|
package/src/base.ts
CHANGED
|
@@ -345,22 +345,19 @@ export abstract class BaseServiceClient {
|
|
|
345
345
|
*/
|
|
346
346
|
private env_options(): RequestOptions {
|
|
347
347
|
const options: RequestOptions = {};
|
|
348
|
-
|
|
349
|
-
return options;
|
|
350
|
-
}
|
|
351
|
-
const stage = process.env.P2_SDK_STAGE;
|
|
348
|
+
const stage = getEnv('P2_SDK_STAGE');
|
|
352
349
|
if (stage) {
|
|
353
350
|
options.stage = stage;
|
|
354
351
|
}
|
|
355
|
-
const token =
|
|
352
|
+
const token = getEnv('P2_SDK_TOKEN');
|
|
356
353
|
if (token) {
|
|
357
354
|
options.token = token;
|
|
358
355
|
}
|
|
359
|
-
const debug =
|
|
356
|
+
const debug = getEnv('P2_SDK_DEBUG');
|
|
360
357
|
if (debug && debug !== '0' && `${debug}`.toLowerCase() !== 'false') {
|
|
361
358
|
options.debug = true;
|
|
362
359
|
}
|
|
363
|
-
const base_url =
|
|
360
|
+
const base_url = getEnv('P2_SDK_BASE_URL');
|
|
364
361
|
if (base_url) {
|
|
365
362
|
if (base_url.includes('=')) {
|
|
366
363
|
options.base_url = {};
|
|
@@ -406,7 +403,7 @@ export abstract class BaseServiceClient {
|
|
|
406
403
|
// add query parameters.
|
|
407
404
|
const query: string[] = [];
|
|
408
405
|
for (const [name, values] of Object.entries(params)) {
|
|
409
|
-
if (typeof values === 'undefined') {
|
|
406
|
+
if (typeof values === 'undefined' && !getEnv('P2_SDK_SEND_UNDEFINED_QUERY')) {
|
|
410
407
|
continue;
|
|
411
408
|
}
|
|
412
409
|
for (const value of Array.isArray(values) ? values : [values]) {
|
|
@@ -601,3 +598,10 @@ export abstract class BaseServiceClient {
|
|
|
601
598
|
return data;
|
|
602
599
|
}
|
|
603
600
|
}
|
|
601
|
+
|
|
602
|
+
function getEnv(name: string): string | undefined {
|
|
603
|
+
if (typeof process === 'undefined') {
|
|
604
|
+
return undefined;
|
|
605
|
+
}
|
|
606
|
+
return process.env[name];
|
|
607
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -142,6 +142,9 @@ import {
|
|
|
142
142
|
GetLocationBrandMenuDeliveryTimeslostsResponse,
|
|
143
143
|
PostLocationBrandBody,
|
|
144
144
|
PostLocationBrandResponse,
|
|
145
|
+
PostLocationBrandBatchGetQuery,
|
|
146
|
+
PostLocationBrandBatchGetBody,
|
|
147
|
+
PostLocationBrandBatchGetResponse,
|
|
145
148
|
PatchLocationBrandBulkBody,
|
|
146
149
|
PatchLocationBrandBulkResponse,
|
|
147
150
|
GetLocationBrandQuery,
|
|
@@ -953,6 +956,8 @@ import {
|
|
|
953
956
|
DeleteMenuV4ItemModifierGroupsDetachResponse,
|
|
954
957
|
PostMenuV4ItemAttachModifierGroupsBody,
|
|
955
958
|
PostMenuV4ItemAttachModifierGroupsResponse,
|
|
959
|
+
DeleteMenuV4ItemsBulkDeleteBody,
|
|
960
|
+
DeleteMenuV4ItemsBulkDeleteResponse,
|
|
956
961
|
PostMenuV4ModifierBody,
|
|
957
962
|
PostMenuV4ModifierResponse,
|
|
958
963
|
GetMenuV4ModifierQuery,
|
|
@@ -966,6 +971,8 @@ import {
|
|
|
966
971
|
PatchMenuV4ModifiersBulkUpdateResponse,
|
|
967
972
|
PostMenuV4ModifierAttachmentQuery,
|
|
968
973
|
PostMenuV4ModifierAttachmentResponse,
|
|
974
|
+
DeleteMenuV4ModifiersBulkDeleteBody,
|
|
975
|
+
DeleteMenuV4ModifiersBulkDeleteResponse,
|
|
969
976
|
PostMenuV4ModifierGroupBody,
|
|
970
977
|
PostMenuV4ModifierGroupResponse,
|
|
971
978
|
GetMenuV4ModifierGroupQuery,
|
|
@@ -2573,6 +2580,28 @@ export class ServiceClient extends BaseServiceClient {
|
|
|
2573
2580
|
return this.request('location', '/location/brand', 'POST', `/location/brand`, body, options);
|
|
2574
2581
|
}
|
|
2575
2582
|
|
|
2583
|
+
/**
|
|
2584
|
+
* POST /location/brand/batch-get - Get multiple brands
|
|
2585
|
+
*
|
|
2586
|
+
* @param body
|
|
2587
|
+
* @param options - additional request options
|
|
2588
|
+
*/
|
|
2589
|
+
post_location_brand_batch_get(
|
|
2590
|
+
body: PostLocationBrandBatchGetBody,
|
|
2591
|
+
options?: {
|
|
2592
|
+
query?: PostLocationBrandBatchGetQuery;
|
|
2593
|
+
} & RequestOptions,
|
|
2594
|
+
): ResponsePromise<PostLocationBrandBatchGetResponse> {
|
|
2595
|
+
return this.request(
|
|
2596
|
+
'location',
|
|
2597
|
+
'/location/brand/batch-get',
|
|
2598
|
+
'POST',
|
|
2599
|
+
`/location/brand/batch-get`,
|
|
2600
|
+
body,
|
|
2601
|
+
options,
|
|
2602
|
+
);
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2576
2605
|
/**
|
|
2577
2606
|
* PATCH /location/brand/bulk - Update multiple brands
|
|
2578
2607
|
*
|
|
@@ -10410,6 +10439,26 @@ export class ServiceClient extends BaseServiceClient {
|
|
|
10410
10439
|
);
|
|
10411
10440
|
}
|
|
10412
10441
|
|
|
10442
|
+
/**
|
|
10443
|
+
* DELETE /menu/v4/items/bulk-delete
|
|
10444
|
+
*
|
|
10445
|
+
* @param body
|
|
10446
|
+
* @param options - additional request options
|
|
10447
|
+
*/
|
|
10448
|
+
delete_menu_v4_items_bulk_delete(
|
|
10449
|
+
body: DeleteMenuV4ItemsBulkDeleteBody,
|
|
10450
|
+
options?: RequestOptions,
|
|
10451
|
+
): ResponsePromise<DeleteMenuV4ItemsBulkDeleteResponse> {
|
|
10452
|
+
return this.request(
|
|
10453
|
+
'menu',
|
|
10454
|
+
'/menu/v4/items/bulk-delete',
|
|
10455
|
+
'DELETE',
|
|
10456
|
+
`/menu/v4/items/bulk-delete`,
|
|
10457
|
+
body,
|
|
10458
|
+
options,
|
|
10459
|
+
);
|
|
10460
|
+
}
|
|
10461
|
+
|
|
10413
10462
|
/**
|
|
10414
10463
|
* POST /menu/v4/modifier
|
|
10415
10464
|
*
|
|
@@ -10553,6 +10602,26 @@ export class ServiceClient extends BaseServiceClient {
|
|
|
10553
10602
|
);
|
|
10554
10603
|
}
|
|
10555
10604
|
|
|
10605
|
+
/**
|
|
10606
|
+
* DELETE /menu/v4/modifiers/bulk-delete
|
|
10607
|
+
*
|
|
10608
|
+
* @param body
|
|
10609
|
+
* @param options - additional request options
|
|
10610
|
+
*/
|
|
10611
|
+
delete_menu_v4_modifiers_bulk_delete(
|
|
10612
|
+
body: DeleteMenuV4ModifiersBulkDeleteBody,
|
|
10613
|
+
options?: RequestOptions,
|
|
10614
|
+
): ResponsePromise<DeleteMenuV4ModifiersBulkDeleteResponse> {
|
|
10615
|
+
return this.request(
|
|
10616
|
+
'menu',
|
|
10617
|
+
'/menu/v4/modifiers/bulk-delete',
|
|
10618
|
+
'DELETE',
|
|
10619
|
+
`/menu/v4/modifiers/bulk-delete`,
|
|
10620
|
+
body,
|
|
10621
|
+
options,
|
|
10622
|
+
);
|
|
10623
|
+
}
|
|
10624
|
+
|
|
10556
10625
|
/**
|
|
10557
10626
|
* POST /menu/v4/modifier-group
|
|
10558
10627
|
*
|
|
@@ -838,6 +838,24 @@ export interface HeroImage {
|
|
|
838
838
|
images: string[];
|
|
839
839
|
}
|
|
840
840
|
|
|
841
|
+
export interface ConsumerAnnouncementDetails {
|
|
842
|
+
image_url?: string;
|
|
843
|
+
title?: string;
|
|
844
|
+
description?: string;
|
|
845
|
+
sub_text?: string;
|
|
846
|
+
button_text?: string;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
export interface ConsumerAnnouncementInfo {
|
|
850
|
+
en?: ConsumerAnnouncementDetails;
|
|
851
|
+
fr?: ConsumerAnnouncementDetails;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
export interface ConsumerAnnouncement {
|
|
855
|
+
app: string;
|
|
856
|
+
info: ConsumerAnnouncementInfo;
|
|
857
|
+
}
|
|
858
|
+
|
|
841
859
|
export interface HomePageOrder {
|
|
842
860
|
meta?: {
|
|
843
861
|
[index: string]: any;
|
|
@@ -1134,6 +1152,8 @@ export interface ConsumerGroup {
|
|
|
1134
1152
|
export interface HomePageResponse {
|
|
1135
1153
|
greetingMessage: DiverseGreetingMessages;
|
|
1136
1154
|
heroImages: HeroImage;
|
|
1155
|
+
// active announcements
|
|
1156
|
+
announcements?: ConsumerAnnouncement[];
|
|
1137
1157
|
// array of orders
|
|
1138
1158
|
orders?: HomePageOrder[];
|
|
1139
1159
|
location?: ConsumerGroup;
|
|
@@ -1987,6 +2007,7 @@ export interface GetConsumerHomePageQuery {
|
|
|
1987
2007
|
end: number;
|
|
1988
2008
|
// current date in epoch time
|
|
1989
2009
|
date: number;
|
|
2010
|
+
location_multigroup_id: string;
|
|
1990
2011
|
// reorder eligible
|
|
1991
2012
|
reorderEligible: boolean;
|
|
1992
2013
|
// Graphql query string
|
|
@@ -1167,6 +1167,31 @@ export interface PostLocationBrandRequest extends BaseRequest {
|
|
|
1167
1167
|
body: PostLocationBrandBody;
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
+
// POST /location/brand/batch-get - Get multiple brands
|
|
1171
|
+
|
|
1172
|
+
export interface PostLocationBrandBatchGetQuery {
|
|
1173
|
+
// If true, includes brand public/private configs into response. Auth should be provided.
|
|
1174
|
+
include_config?: boolean;
|
|
1175
|
+
// show additional hidden properties/entities
|
|
1176
|
+
extended?: boolean;
|
|
1177
|
+
// determine whether to calculate estimated_wait_time
|
|
1178
|
+
include_estimated_wait_time?: boolean;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
export interface PostLocationBrandBatchGetBody {
|
|
1182
|
+
ids?: string[];
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
export interface PostLocationBrandBatchGetResponse {
|
|
1186
|
+
brands?: Brands;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
export interface PostLocationBrandBatchGetRequest
|
|
1190
|
+
extends BaseRequest,
|
|
1191
|
+
RequestQuery<PostLocationBrandBatchGetQuery> {
|
|
1192
|
+
body: PostLocationBrandBatchGetBody;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1170
1195
|
// PATCH /location/brand/bulk - Update multiple brands
|
|
1171
1196
|
|
|
1172
1197
|
export interface PatchLocationBrandBulkBody {
|
package/src/interface/menu.ts
CHANGED
|
@@ -8900,6 +8900,22 @@ export interface PostMenuV4ItemAttachModifierGroupsRequest
|
|
|
8900
8900
|
body: PostMenuV4ItemAttachModifierGroupsBody;
|
|
8901
8901
|
}
|
|
8902
8902
|
|
|
8903
|
+
// DELETE /menu/v4/items/bulk-delete
|
|
8904
|
+
|
|
8905
|
+
export interface DeleteMenuV4ItemsBulkDeleteBody {
|
|
8906
|
+
id_list: string[];
|
|
8907
|
+
[index: string]: any;
|
|
8908
|
+
}
|
|
8909
|
+
|
|
8910
|
+
export interface DeleteMenuV4ItemsBulkDeleteResponse {
|
|
8911
|
+
meta?: Record<string, any>;
|
|
8912
|
+
results?: DraftItemEntityDTO[];
|
|
8913
|
+
}
|
|
8914
|
+
|
|
8915
|
+
export interface DeleteMenuV4ItemsBulkDeleteRequest extends BaseRequest {
|
|
8916
|
+
body: DeleteMenuV4ItemsBulkDeleteBody;
|
|
8917
|
+
}
|
|
8918
|
+
|
|
8903
8919
|
// POST /menu/v4/modifier
|
|
8904
8920
|
|
|
8905
8921
|
export interface PostMenuV4ModifierBody {
|
|
@@ -9380,6 +9396,22 @@ export interface PostMenuV4ModifierAttachmentRequest
|
|
|
9380
9396
|
RequestQuery<PostMenuV4ModifierAttachmentQuery>,
|
|
9381
9397
|
PostMenuV4ModifierAttachmentPath {}
|
|
9382
9398
|
|
|
9399
|
+
// DELETE /menu/v4/modifiers/bulk-delete
|
|
9400
|
+
|
|
9401
|
+
export interface DeleteMenuV4ModifiersBulkDeleteBody {
|
|
9402
|
+
id_list: string[];
|
|
9403
|
+
[index: string]: any;
|
|
9404
|
+
}
|
|
9405
|
+
|
|
9406
|
+
export interface DeleteMenuV4ModifiersBulkDeleteResponse {
|
|
9407
|
+
meta?: Record<string, any>;
|
|
9408
|
+
results?: DraftModifierEntityDTO[];
|
|
9409
|
+
}
|
|
9410
|
+
|
|
9411
|
+
export interface DeleteMenuV4ModifiersBulkDeleteRequest extends BaseRequest {
|
|
9412
|
+
body: DeleteMenuV4ModifiersBulkDeleteBody;
|
|
9413
|
+
}
|
|
9414
|
+
|
|
9383
9415
|
// POST /menu/v4/modifier-group
|
|
9384
9416
|
|
|
9385
9417
|
export interface PostMenuV4ModifierGroupBody {
|