@atlas-kitchen/atlas-mcp 1.0.3 → 1.1.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/.env.example +7 -3
- package/CLAUDE.md +72 -63
- package/README.md +85 -103
- package/dist/auth.d.ts +1 -7
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +1 -26
- package/dist/auth.js.map +1 -1
- package/dist/client.d.ts +9 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +117 -806
- package/dist/client.js.map +1 -1
- package/dist/index.js +97 -8
- package/dist/index.js.map +1 -1
- package/dist/token-cache.d.ts +11 -0
- package/dist/token-cache.d.ts.map +1 -0
- package/dist/token-cache.js +34 -0
- package/dist/token-cache.js.map +1 -0
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +74 -84
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/menu.d.ts +1 -2
- package/dist/tools/menu.d.ts.map +1 -1
- package/dist/tools/menu.js +6 -121
- package/dist/tools/menu.js.map +1 -1
- package/dist/tools/orders.d.ts.map +1 -1
- package/dist/tools/orders.js +29 -41
- package/dist/tools/orders.js.map +1 -1
- package/dist/tools/reports.d.ts +1 -2
- package/dist/tools/reports.d.ts.map +1 -1
- package/dist/tools/reports.js +24 -82
- package/dist/tools/reports.js.map +1 -1
- package/dist/types/atlas.d.ts +4 -0
- package/dist/types/atlas.d.ts.map +1 -1
- package/package.json +11 -2
- package/dist/polyfills.d.ts +0 -2
- package/dist/polyfills.d.ts.map +0 -1
package/dist/client.js
CHANGED
|
@@ -4,22 +4,35 @@ export class AtlasClient {
|
|
|
4
4
|
accountClient;
|
|
5
5
|
authManager;
|
|
6
6
|
baseUrl;
|
|
7
|
+
_isRetrying = false;
|
|
8
|
+
onAuthFailure = null;
|
|
7
9
|
constructor(authManager) {
|
|
8
10
|
this.authManager = authManager;
|
|
9
11
|
this.baseUrl = process.env.ATLAS_GRAPHQL_ENDPOINT || 'https://api.atlas.kitchen';
|
|
10
|
-
// Create separate clients for different graph contexts
|
|
11
12
|
this.restaurantClient = new GraphQLClient(`${this.baseUrl}/v1/restaurants/graphql`);
|
|
12
13
|
this.accountClient = new GraphQLClient(`${this.baseUrl}/v1/accounts/graphql`);
|
|
13
14
|
}
|
|
14
15
|
async request(query, variables, context = 'restaurants') {
|
|
15
16
|
const client = context === 'accounts' ? this.accountClient : this.restaurantClient;
|
|
16
17
|
try {
|
|
17
|
-
// Set headers for this request
|
|
18
18
|
const headers = this.authManager.getHeaders();
|
|
19
19
|
return await client.request(query, variables, headers);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
//
|
|
22
|
+
// Check for auth failure and retry once (guard against recursion from auth calls)
|
|
23
|
+
if (!this._isRetrying && this.isAuthError(error) && this.onAuthFailure) {
|
|
24
|
+
this._isRetrying = true;
|
|
25
|
+
try {
|
|
26
|
+
const recovered = await this.onAuthFailure();
|
|
27
|
+
if (recovered) {
|
|
28
|
+
const headers = this.authManager.getHeaders();
|
|
29
|
+
return await client.request(query, variables, headers);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
this._isRetrying = false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
23
36
|
if (error.response?.errors) {
|
|
24
37
|
const graphqlError = error.response.errors[0];
|
|
25
38
|
throw new Error(`GraphQL Error: ${graphqlError.message}`);
|
|
@@ -27,38 +40,26 @@ export class AtlasClient {
|
|
|
27
40
|
throw error;
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
account {
|
|
37
|
-
id
|
|
38
|
-
email
|
|
39
|
-
}
|
|
40
|
-
merchants {
|
|
41
|
-
identifier
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
const response = await this.request(query, { email, password }, 'accounts');
|
|
47
|
-
return response.accountLogin;
|
|
43
|
+
isAuthError(error) {
|
|
44
|
+
const status = error.response?.status;
|
|
45
|
+
if (status === 401 || status === 403)
|
|
46
|
+
return true;
|
|
47
|
+
const message = error.response?.errors?.[0]?.message || error.message || '';
|
|
48
|
+
return /unauthorized|unauthenticated|not logged in|token.*expired|invalid.*token/i.test(message);
|
|
48
49
|
}
|
|
49
|
-
async
|
|
50
|
+
async apiKeyLogin(apiKey) {
|
|
50
51
|
const query = `
|
|
51
|
-
mutation
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
mutation ApiKeyLogin($apiKey: String!) {
|
|
53
|
+
apiKeyLogin(input: { apiKey: $apiKey }) {
|
|
54
|
+
accessToken
|
|
55
|
+
refreshToken
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
`;
|
|
57
|
-
const response = await this.request(query, {}, 'accounts');
|
|
58
|
-
return response.
|
|
59
|
+
const response = await this.request(query, { apiKey }, 'accounts');
|
|
60
|
+
return response.apiKeyLogin;
|
|
59
61
|
}
|
|
60
62
|
async refreshToken(refreshToken) {
|
|
61
|
-
// Temporarily set the refresh token as the access token for this request
|
|
62
63
|
const currentToken = this.authManager.getAccessToken();
|
|
63
64
|
this.authManager.setTokens({ accessToken: refreshToken, refreshToken: refreshToken });
|
|
64
65
|
try {
|
|
@@ -67,29 +68,6 @@ export class AtlasClient {
|
|
|
67
68
|
accountGenerateAccessToken {
|
|
68
69
|
accessToken
|
|
69
70
|
refreshToken
|
|
70
|
-
account {
|
|
71
|
-
id
|
|
72
|
-
email
|
|
73
|
-
name
|
|
74
|
-
username
|
|
75
|
-
isVerified
|
|
76
|
-
requireSetPassword
|
|
77
|
-
merchants {
|
|
78
|
-
id
|
|
79
|
-
identifier
|
|
80
|
-
name
|
|
81
|
-
}
|
|
82
|
-
merchantAccounts {
|
|
83
|
-
id
|
|
84
|
-
merchantId
|
|
85
|
-
role
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
merchants {
|
|
89
|
-
id
|
|
90
|
-
identifier
|
|
91
|
-
name
|
|
92
|
-
}
|
|
93
71
|
}
|
|
94
72
|
}
|
|
95
73
|
`;
|
|
@@ -97,76 +75,45 @@ export class AtlasClient {
|
|
|
97
75
|
return response.accountGenerateAccessToken;
|
|
98
76
|
}
|
|
99
77
|
finally {
|
|
100
|
-
// Restore the original token if the refresh failed
|
|
101
78
|
if (currentToken) {
|
|
102
79
|
this.authManager.setTokens({ accessToken: currentToken, refreshToken: refreshToken });
|
|
103
80
|
}
|
|
104
81
|
}
|
|
105
82
|
}
|
|
83
|
+
async getMerchants() {
|
|
84
|
+
const query = `
|
|
85
|
+
query GetMerchants {
|
|
86
|
+
account {
|
|
87
|
+
merchants {
|
|
88
|
+
brandAndEntityNames
|
|
89
|
+
id
|
|
90
|
+
identifier
|
|
91
|
+
name
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
const response = await this.request(query, undefined, 'accounts');
|
|
97
|
+
return response.account.merchants;
|
|
98
|
+
}
|
|
106
99
|
async getOrders(filters = {}) {
|
|
107
100
|
const query = `
|
|
108
101
|
query GetOrders($filter: OrderFilter) {
|
|
109
|
-
|
|
102
|
+
allOrdersOptimised(filter: $filter) {
|
|
110
103
|
totalCount
|
|
111
104
|
page
|
|
112
105
|
perPage
|
|
113
|
-
metadata
|
|
114
106
|
orders {
|
|
115
|
-
state
|
|
116
107
|
identifier
|
|
108
|
+
brand
|
|
109
|
+
outlet
|
|
117
110
|
servingDate
|
|
118
|
-
|
|
119
|
-
addressLine1
|
|
120
|
-
addressLine2
|
|
121
|
-
postalCode
|
|
122
|
-
brand {
|
|
123
|
-
label
|
|
124
|
-
}
|
|
111
|
+
orderDate
|
|
125
112
|
timeslotRange
|
|
126
113
|
fulfilmentType
|
|
127
|
-
fulfilmentSubType
|
|
128
|
-
fulfilmentState
|
|
129
|
-
isContactless
|
|
130
|
-
isCutleryRequired
|
|
131
|
-
notes
|
|
132
|
-
paymentBreakdown {
|
|
133
|
-
total
|
|
134
|
-
totalIncludingTax
|
|
135
|
-
tip
|
|
136
|
-
}
|
|
137
|
-
table {
|
|
138
|
-
name
|
|
139
|
-
}
|
|
140
|
-
outlet {
|
|
141
|
-
label
|
|
142
|
-
labelForPickup
|
|
143
|
-
}
|
|
144
|
-
id
|
|
145
|
-
sourceLabel
|
|
146
|
-
servedByName
|
|
147
|
-
externalOrderShortCode
|
|
148
|
-
topLevelItems {
|
|
149
|
-
name
|
|
150
|
-
quantity
|
|
151
|
-
}
|
|
152
114
|
contactName
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
isGift
|
|
156
|
-
recipientName
|
|
157
|
-
recipientContactNumber
|
|
158
|
-
giftMessage
|
|
159
|
-
currentTrip {
|
|
160
|
-
externalLogisticsId
|
|
161
|
-
externalLogisticsCode
|
|
162
|
-
externalLogisticsType
|
|
163
|
-
merchantLogisticsCost
|
|
164
|
-
}
|
|
165
|
-
orderPayments {
|
|
166
|
-
paymentType {
|
|
167
|
-
label
|
|
168
|
-
}
|
|
169
|
-
}
|
|
115
|
+
topLevelItems
|
|
116
|
+
totalIncludingTax
|
|
170
117
|
}
|
|
171
118
|
}
|
|
172
119
|
}
|
|
@@ -174,20 +121,20 @@ export class AtlasClient {
|
|
|
174
121
|
// Transform filters to match OrderFilter structure
|
|
175
122
|
const filter = {};
|
|
176
123
|
if (filters.startDate || filters.endDate) {
|
|
177
|
-
filter.
|
|
124
|
+
filter.servingDateBetween = {};
|
|
178
125
|
if (filters.startDate)
|
|
179
|
-
filter.
|
|
126
|
+
filter.servingDateBetween.start_date = filters.startDate;
|
|
180
127
|
if (filters.endDate)
|
|
181
|
-
filter.
|
|
128
|
+
filter.servingDateBetween.end_date = filters.endDate;
|
|
182
129
|
}
|
|
183
130
|
if (filters.state)
|
|
184
131
|
filter.state = filters.state;
|
|
185
|
-
if (filters.
|
|
186
|
-
filter.perPage = filters.
|
|
187
|
-
if (filters.
|
|
188
|
-
filter.page = filters.
|
|
132
|
+
if (filters.perPage)
|
|
133
|
+
filter.perPage = filters.perPage;
|
|
134
|
+
if (filters.page)
|
|
135
|
+
filter.page = filters.page;
|
|
189
136
|
const response = await this.request(query, { filter });
|
|
190
|
-
return response.
|
|
137
|
+
return response.allOrdersOptimised;
|
|
191
138
|
}
|
|
192
139
|
async getOrder(orderId) {
|
|
193
140
|
const query = `
|
|
@@ -198,65 +145,40 @@ export class AtlasClient {
|
|
|
198
145
|
state
|
|
199
146
|
servingDate
|
|
200
147
|
prepareBy
|
|
201
|
-
|
|
202
|
-
isCutleryRequired
|
|
148
|
+
createdAt
|
|
203
149
|
fulfilmentType
|
|
204
150
|
fulfilmentSubType
|
|
205
151
|
fulfilmentState
|
|
206
152
|
notes
|
|
207
|
-
buzzerIdentifier
|
|
208
|
-
chargeId
|
|
209
|
-
stripeAccountId
|
|
210
|
-
isAdyenEnabled
|
|
211
153
|
sourceLabel
|
|
212
154
|
externalOrderShortCode
|
|
213
155
|
contactName
|
|
214
156
|
contactNumber
|
|
215
157
|
contactEmail
|
|
216
|
-
contactAccessCode
|
|
217
158
|
isGift
|
|
218
159
|
recipientName
|
|
219
160
|
recipientContactNumber
|
|
220
161
|
giftMessage
|
|
221
162
|
promoCode
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
invoices {
|
|
226
|
-
id
|
|
227
|
-
paymentStatus
|
|
228
|
-
totalPaid
|
|
229
|
-
totalRefunded
|
|
230
|
-
amountOutstanding
|
|
231
|
-
invoicePayments {
|
|
232
|
-
id
|
|
233
|
-
createdAt
|
|
234
|
-
amount
|
|
235
|
-
paymentType {
|
|
236
|
-
label
|
|
237
|
-
}
|
|
238
|
-
reference
|
|
239
|
-
referenceType
|
|
240
|
-
notes
|
|
241
|
-
invoicePaymentRefunds {
|
|
242
|
-
id
|
|
243
|
-
createdAt
|
|
244
|
-
amount
|
|
245
|
-
reason
|
|
246
|
-
reference
|
|
247
|
-
referenceType
|
|
248
|
-
paymentType {
|
|
249
|
-
label
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
163
|
+
servedByName
|
|
164
|
+
brand {
|
|
165
|
+
label
|
|
253
166
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
isCustomCurrency
|
|
167
|
+
outlet {
|
|
168
|
+
id
|
|
257
169
|
label
|
|
258
|
-
|
|
170
|
+
labelForPickup
|
|
171
|
+
}
|
|
172
|
+
table {
|
|
173
|
+
name
|
|
259
174
|
}
|
|
175
|
+
address {
|
|
176
|
+
line1
|
|
177
|
+
line2
|
|
178
|
+
postalCode
|
|
179
|
+
notes
|
|
180
|
+
}
|
|
181
|
+
timeslotRange
|
|
260
182
|
promotion {
|
|
261
183
|
id
|
|
262
184
|
type
|
|
@@ -271,39 +193,6 @@ export class AtlasClient {
|
|
|
271
193
|
quantity
|
|
272
194
|
reason
|
|
273
195
|
promoCode
|
|
274
|
-
targetType
|
|
275
|
-
sourceType
|
|
276
|
-
sourceId
|
|
277
|
-
}
|
|
278
|
-
createdAt
|
|
279
|
-
externalOrderedAt
|
|
280
|
-
payAtStation
|
|
281
|
-
serveByOverride
|
|
282
|
-
servedByName
|
|
283
|
-
table {
|
|
284
|
-
name
|
|
285
|
-
}
|
|
286
|
-
address {
|
|
287
|
-
id
|
|
288
|
-
line1
|
|
289
|
-
line2
|
|
290
|
-
postalCode
|
|
291
|
-
notes
|
|
292
|
-
}
|
|
293
|
-
brand {
|
|
294
|
-
label
|
|
295
|
-
}
|
|
296
|
-
timeslotId
|
|
297
|
-
timeslotType
|
|
298
|
-
timeslotRange
|
|
299
|
-
currentTrip {
|
|
300
|
-
externalLogisticsId
|
|
301
|
-
externalLogisticsCode
|
|
302
|
-
externalLogisticsType
|
|
303
|
-
externalLogisticsTrackingUrl
|
|
304
|
-
isCancelled
|
|
305
|
-
logisticsDriverInfo
|
|
306
|
-
logisticsStatus
|
|
307
196
|
}
|
|
308
197
|
topLevelItems {
|
|
309
198
|
id
|
|
@@ -311,236 +200,63 @@ export class AtlasClient {
|
|
|
311
200
|
quantity
|
|
312
201
|
notes
|
|
313
202
|
subtotal
|
|
314
|
-
itemModifierGroupId
|
|
315
|
-
paid
|
|
316
|
-
amountPaid
|
|
317
|
-
discount
|
|
318
|
-
refunds
|
|
319
|
-
refundableAmount
|
|
320
203
|
unitPriceFractional
|
|
321
204
|
unitLabel
|
|
322
|
-
|
|
323
|
-
item {
|
|
324
|
-
id
|
|
325
|
-
isConfigurable
|
|
326
|
-
idBreadcrumb
|
|
327
|
-
horizontalImageUrl
|
|
328
|
-
}
|
|
329
|
-
isOpenItem
|
|
330
|
-
adjustmentReason {
|
|
331
|
-
id
|
|
332
|
-
label
|
|
333
|
-
}
|
|
334
|
-
sortedSubItems {
|
|
335
|
-
id
|
|
336
|
-
idBreadcrumb
|
|
337
|
-
label
|
|
338
|
-
subItems {
|
|
339
|
-
id
|
|
340
|
-
name
|
|
341
|
-
quantity
|
|
342
|
-
subtotal
|
|
343
|
-
unitLabel
|
|
344
|
-
customIdentifier
|
|
345
|
-
item {
|
|
346
|
-
id
|
|
347
|
-
isConfigurable
|
|
348
|
-
idBreadcrumb
|
|
349
|
-
horizontalImageUrl
|
|
350
|
-
}
|
|
351
|
-
adjustmentReason {
|
|
352
|
-
id
|
|
353
|
-
label
|
|
354
|
-
}
|
|
355
|
-
sortedSubItems {
|
|
356
|
-
id
|
|
357
|
-
idBreadcrumb
|
|
358
|
-
label
|
|
359
|
-
subItems {
|
|
360
|
-
id
|
|
361
|
-
name
|
|
362
|
-
quantity
|
|
363
|
-
subtotal
|
|
364
|
-
unitLabel
|
|
365
|
-
customIdentifier
|
|
366
|
-
item {
|
|
367
|
-
id
|
|
368
|
-
isConfigurable
|
|
369
|
-
idBreadcrumb
|
|
370
|
-
horizontalImageUrl
|
|
371
|
-
}
|
|
372
|
-
adjustmentReason {
|
|
373
|
-
id
|
|
374
|
-
label
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
205
|
+
discount
|
|
380
206
|
subItems {
|
|
381
207
|
id
|
|
382
|
-
modifierId
|
|
383
|
-
itemModifierGroupId
|
|
384
208
|
name
|
|
385
209
|
quantity
|
|
386
210
|
subtotal
|
|
387
211
|
unitLabel
|
|
388
|
-
perUnitQuantity
|
|
389
|
-
customIdentifier
|
|
390
|
-
adjustmentReason {
|
|
391
|
-
id
|
|
392
|
-
label
|
|
393
|
-
}
|
|
394
212
|
unitPriceFractional
|
|
395
213
|
subItems {
|
|
396
214
|
id
|
|
397
|
-
modifierId
|
|
398
|
-
itemModifierGroupId
|
|
399
215
|
name
|
|
400
216
|
quantity
|
|
401
217
|
subtotal
|
|
402
|
-
unitLabel
|
|
403
|
-
perUnitQuantity
|
|
404
|
-
customIdentifier
|
|
405
|
-
adjustmentReason {
|
|
406
|
-
id
|
|
407
|
-
label
|
|
408
|
-
}
|
|
409
|
-
unitPriceFractional
|
|
410
218
|
}
|
|
411
219
|
}
|
|
412
220
|
appliedDiscounts {
|
|
413
221
|
id
|
|
414
222
|
value
|
|
415
223
|
percentValue
|
|
416
|
-
quantity
|
|
417
224
|
reason
|
|
418
225
|
}
|
|
419
226
|
}
|
|
420
227
|
user {
|
|
421
|
-
id
|
|
422
|
-
userId
|
|
423
|
-
name
|
|
424
|
-
email
|
|
425
|
-
mobileNumber
|
|
426
|
-
isGuest
|
|
427
|
-
addresses {
|
|
428
|
-
id
|
|
429
|
-
line1
|
|
430
|
-
line2
|
|
431
|
-
nearestOutlet {
|
|
432
|
-
id
|
|
433
|
-
label
|
|
434
|
-
labelForPickup
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
outlet {
|
|
439
228
|
id
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
id
|
|
445
|
-
name
|
|
446
|
-
posEnabled
|
|
447
|
-
printers {
|
|
448
|
-
id
|
|
449
|
-
name
|
|
450
|
-
}
|
|
451
|
-
paymentTerminals {
|
|
452
|
-
id
|
|
453
|
-
}
|
|
454
|
-
}
|
|
229
|
+
name
|
|
230
|
+
email
|
|
231
|
+
mobileNumber
|
|
232
|
+
isGuest
|
|
455
233
|
}
|
|
456
234
|
paymentBreakdown {
|
|
457
235
|
subtotal
|
|
458
|
-
merchantTotalIncludingTax
|
|
459
|
-
merchantTax
|
|
460
236
|
totalIncludingTax
|
|
461
237
|
tax
|
|
462
|
-
taxInclusivePrices
|
|
463
|
-
cashVouchersAmount
|
|
464
238
|
surcharge
|
|
465
|
-
surchargeLabel
|
|
466
239
|
serviceCharge
|
|
467
|
-
serviceChargeDiscount
|
|
468
|
-
donationAmount
|
|
469
|
-
donationLabel
|
|
470
|
-
pointsAmount
|
|
471
|
-
pointsValue
|
|
472
240
|
tip
|
|
473
241
|
discount
|
|
474
|
-
platformDiscount
|
|
475
|
-
adminDiscount
|
|
476
242
|
deliveryFee
|
|
477
|
-
platformDeliveryFee
|
|
478
243
|
amountUnpaid
|
|
479
244
|
rounding
|
|
480
245
|
}
|
|
481
|
-
minimumVehicleType
|
|
482
|
-
minimumVehicleTypeItemLabel
|
|
483
|
-
minimumVehicleTypeOrderValue
|
|
484
|
-
paymentLinkId
|
|
485
|
-
paymentLinkUrl
|
|
486
|
-
paymentTypeId
|
|
487
|
-
paymentTypeLabel
|
|
488
|
-
paymentType {
|
|
489
|
-
id
|
|
490
|
-
label
|
|
491
|
-
subType
|
|
492
|
-
paymentTypeImageUrl
|
|
493
|
-
paymentMethodId
|
|
494
|
-
}
|
|
495
|
-
cart {
|
|
496
|
-
id
|
|
497
|
-
bills {
|
|
498
|
-
id
|
|
499
|
-
capturedAt
|
|
500
|
-
total
|
|
501
|
-
paymentType {
|
|
502
|
-
id
|
|
503
|
-
label
|
|
504
|
-
subType
|
|
505
|
-
paymentTypeImageUrl
|
|
506
|
-
paymentMethodId
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
capturedAmount
|
|
510
|
-
uncapturedAmount
|
|
511
|
-
cartCashVouchers {
|
|
512
|
-
id
|
|
513
|
-
quantity
|
|
514
|
-
voucherReference
|
|
515
|
-
cashVoucher {
|
|
516
|
-
id
|
|
517
|
-
label
|
|
518
|
-
value
|
|
519
|
-
code
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
246
|
orderPayments {
|
|
524
247
|
id
|
|
525
248
|
amount
|
|
526
249
|
tip
|
|
527
|
-
isCaptured
|
|
528
|
-
captureId
|
|
529
250
|
paymentType {
|
|
530
251
|
id
|
|
531
252
|
label
|
|
532
|
-
subType
|
|
533
|
-
paymentTypeImageUrl
|
|
534
|
-
paymentMethodId
|
|
535
253
|
}
|
|
536
254
|
cardLast4
|
|
537
255
|
orderRefunds {
|
|
538
256
|
id
|
|
539
|
-
type
|
|
540
257
|
amount
|
|
541
258
|
reason
|
|
542
259
|
isSuccessful
|
|
543
|
-
responseReason
|
|
544
260
|
}
|
|
545
261
|
}
|
|
546
262
|
}
|
|
@@ -556,251 +272,75 @@ export class AtlasClient {
|
|
|
556
272
|
query GetPosCartOptimised($cartId: Int!) {
|
|
557
273
|
getPosCartOptimised(cartId: $cartId) {
|
|
558
274
|
id
|
|
559
|
-
archived
|
|
560
275
|
isCheckedOut
|
|
561
|
-
promoCode
|
|
562
|
-
promoCodeError
|
|
563
276
|
platform
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
promotion {
|
|
567
|
-
id
|
|
568
|
-
type
|
|
569
|
-
label
|
|
570
|
-
description
|
|
571
|
-
value
|
|
572
|
-
valueType
|
|
573
|
-
}
|
|
574
|
-
cartDiscounts {
|
|
575
|
-
id
|
|
576
|
-
discountType
|
|
577
|
-
value
|
|
578
|
-
quantity
|
|
579
|
-
reason
|
|
580
|
-
promoCode
|
|
581
|
-
targetType
|
|
582
|
-
sourceType
|
|
583
|
-
sourceId
|
|
584
|
-
}
|
|
585
|
-
cartCashVouchers {
|
|
586
|
-
id
|
|
587
|
-
cashVoucherId
|
|
588
|
-
voucherReference
|
|
589
|
-
quantity
|
|
590
|
-
cashVoucher {
|
|
591
|
-
id
|
|
592
|
-
code
|
|
593
|
-
value
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
cashVouchers {
|
|
597
|
-
id
|
|
598
|
-
code
|
|
599
|
-
value
|
|
600
|
-
}
|
|
601
|
-
donationId
|
|
602
|
-
isPostTaxDiscount
|
|
603
|
-
serviceChargeable
|
|
604
|
-
paymentBreakdown {
|
|
605
|
-
deliveryFee
|
|
606
|
-
surcharge
|
|
607
|
-
surchargeLabel
|
|
608
|
-
discount
|
|
609
|
-
donationAmount
|
|
610
|
-
cashVouchersAmount
|
|
611
|
-
tax
|
|
612
|
-
subtotal
|
|
613
|
-
serviceCharge
|
|
614
|
-
serviceChargeDiscount
|
|
615
|
-
totalIncludingTax
|
|
616
|
-
taxInclusivePrices
|
|
617
|
-
rounding
|
|
618
|
-
cashRounding
|
|
619
|
-
pointsValue
|
|
620
|
-
pointsAmount
|
|
621
|
-
usePoints
|
|
622
|
-
}
|
|
277
|
+
fulfilmentType
|
|
278
|
+
promoCode
|
|
623
279
|
notes
|
|
624
|
-
|
|
625
|
-
|
|
280
|
+
tableName
|
|
281
|
+
outletId
|
|
282
|
+
servingDate
|
|
283
|
+
pax
|
|
284
|
+
paxKids
|
|
285
|
+
paymentTypeLabel
|
|
626
286
|
user {
|
|
627
287
|
id
|
|
628
|
-
userId
|
|
629
288
|
name
|
|
630
289
|
email
|
|
631
290
|
mobileNumber
|
|
632
291
|
isGuest
|
|
633
292
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
293
|
+
paymentBreakdown {
|
|
294
|
+
subtotal
|
|
295
|
+
totalIncludingTax
|
|
296
|
+
tax
|
|
297
|
+
surcharge
|
|
298
|
+
serviceCharge
|
|
299
|
+
discount
|
|
300
|
+
deliveryFee
|
|
301
|
+
rounding
|
|
302
|
+
}
|
|
639
303
|
topLevelItems {
|
|
640
304
|
id
|
|
641
305
|
name
|
|
642
306
|
quantity
|
|
643
307
|
notes
|
|
644
308
|
subtotal
|
|
645
|
-
serviceChargeable
|
|
646
|
-
itemModifierGroupId
|
|
647
|
-
sentAt
|
|
648
309
|
unitLabel
|
|
649
|
-
|
|
650
|
-
seatId
|
|
651
|
-
cartItemGroup {
|
|
652
|
-
id
|
|
653
|
-
label
|
|
654
|
-
createdAt
|
|
655
|
-
groupType
|
|
656
|
-
}
|
|
657
|
-
adjustmentReason {
|
|
658
|
-
id
|
|
659
|
-
label
|
|
660
|
-
}
|
|
661
|
-
appliedDiscounts {
|
|
662
|
-
id
|
|
663
|
-
value
|
|
664
|
-
percentValue
|
|
665
|
-
quantity
|
|
666
|
-
reason
|
|
667
|
-
sourceType
|
|
668
|
-
sourceId
|
|
669
|
-
}
|
|
670
|
-
itemId
|
|
671
|
-
item {
|
|
672
|
-
id
|
|
673
|
-
idBreadcrumb
|
|
674
|
-
horizontalImageUrl
|
|
675
|
-
}
|
|
676
|
-
isOpenItem
|
|
677
|
-
sortedSubItems {
|
|
678
|
-
idBreadcrumb
|
|
679
|
-
label
|
|
680
|
-
subItems {
|
|
681
|
-
id
|
|
682
|
-
itemId
|
|
683
|
-
name
|
|
684
|
-
notes
|
|
685
|
-
quantity
|
|
686
|
-
subtotal
|
|
687
|
-
unitLabel
|
|
688
|
-
customIdentifier
|
|
689
|
-
adjustmentReason {
|
|
690
|
-
id
|
|
691
|
-
label
|
|
692
|
-
}
|
|
693
|
-
sortedSubItems {
|
|
694
|
-
idBreadcrumb
|
|
695
|
-
label
|
|
696
|
-
subItems {
|
|
697
|
-
id
|
|
698
|
-
itemId
|
|
699
|
-
name
|
|
700
|
-
notes
|
|
701
|
-
quantity
|
|
702
|
-
subtotal
|
|
703
|
-
unitLabel
|
|
704
|
-
customIdentifier
|
|
705
|
-
adjustmentReason {
|
|
706
|
-
id
|
|
707
|
-
label
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
310
|
+
sentAt
|
|
713
311
|
subItems {
|
|
714
312
|
id
|
|
715
|
-
itemId
|
|
716
|
-
modifierId
|
|
717
|
-
itemModifierGroupId
|
|
718
313
|
name
|
|
719
|
-
notes
|
|
720
314
|
quantity
|
|
721
315
|
subtotal
|
|
722
316
|
unitLabel
|
|
723
|
-
customIdentifier
|
|
724
|
-
adjustmentReason {
|
|
725
|
-
id
|
|
726
|
-
label
|
|
727
|
-
}
|
|
728
317
|
subItems {
|
|
729
318
|
id
|
|
730
|
-
itemId
|
|
731
|
-
modifierId
|
|
732
|
-
itemModifierGroupId
|
|
733
319
|
name
|
|
734
|
-
notes
|
|
735
320
|
quantity
|
|
736
321
|
subtotal
|
|
737
|
-
unitLabel
|
|
738
|
-
customIdentifier
|
|
739
|
-
adjustmentReason {
|
|
740
|
-
id
|
|
741
|
-
label
|
|
742
|
-
}
|
|
743
322
|
}
|
|
744
323
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
servingDate
|
|
752
|
-
timeslotType
|
|
753
|
-
timeslot {
|
|
754
|
-
id
|
|
755
|
-
rangeLabel
|
|
756
|
-
}
|
|
757
|
-
address {
|
|
758
|
-
id
|
|
759
|
-
line1
|
|
760
|
-
line2
|
|
761
|
-
postalCode
|
|
762
|
-
notes
|
|
324
|
+
appliedDiscounts {
|
|
325
|
+
id
|
|
326
|
+
value
|
|
327
|
+
percentValue
|
|
328
|
+
reason
|
|
329
|
+
}
|
|
763
330
|
}
|
|
764
331
|
hasUnsentItems
|
|
765
332
|
hasSentItems
|
|
766
|
-
hasHeldItems
|
|
767
333
|
bills {
|
|
768
334
|
id
|
|
769
|
-
billItemsCount
|
|
770
335
|
capturedAt
|
|
771
|
-
|
|
772
|
-
donation
|
|
773
|
-
paymentTypeId
|
|
336
|
+
total
|
|
774
337
|
paymentType {
|
|
775
338
|
id
|
|
776
339
|
label
|
|
777
340
|
}
|
|
778
|
-
tax
|
|
779
|
-
total
|
|
780
|
-
type
|
|
781
|
-
billItems {
|
|
782
|
-
id
|
|
783
|
-
cartItemId
|
|
784
|
-
cartItem {
|
|
785
|
-
id
|
|
786
|
-
name
|
|
787
|
-
quantity
|
|
788
|
-
notes
|
|
789
|
-
}
|
|
790
|
-
quantity
|
|
791
|
-
total
|
|
792
|
-
}
|
|
793
341
|
}
|
|
794
342
|
capturedAmount
|
|
795
343
|
uncapturedAmount
|
|
796
|
-
splitAmount
|
|
797
|
-
unsplitAmount
|
|
798
|
-
uncapturedCartItems {
|
|
799
|
-
id
|
|
800
|
-
name
|
|
801
|
-
quantity
|
|
802
|
-
subtotal
|
|
803
|
-
}
|
|
804
344
|
}
|
|
805
345
|
}
|
|
806
346
|
`;
|
|
@@ -841,188 +381,6 @@ export class AtlasClient {
|
|
|
841
381
|
const response = await this.request(query);
|
|
842
382
|
return response.allOpenPosCarts;
|
|
843
383
|
}
|
|
844
|
-
async getMenus(outletId, servingDate, timeslotType) {
|
|
845
|
-
const query = `
|
|
846
|
-
query GetMenus($outletId: Int, $servingDate: ISO8601Date, $timeslotType: String) {
|
|
847
|
-
menus(outletId: $outletId, servingDate: $servingDate, timeslotType: $timeslotType) {
|
|
848
|
-
id
|
|
849
|
-
state
|
|
850
|
-
label
|
|
851
|
-
identifier
|
|
852
|
-
startDate
|
|
853
|
-
endDate
|
|
854
|
-
createdAt
|
|
855
|
-
updatedAt
|
|
856
|
-
brandId
|
|
857
|
-
tagList
|
|
858
|
-
imageUrl
|
|
859
|
-
brand {
|
|
860
|
-
label
|
|
861
|
-
}
|
|
862
|
-
outletBrands {
|
|
863
|
-
outletId
|
|
864
|
-
brandId
|
|
865
|
-
grabFoodMerchantId
|
|
866
|
-
foodpandaMerchantId
|
|
867
|
-
}
|
|
868
|
-
brandOutletMenus {
|
|
869
|
-
outletId
|
|
870
|
-
brandId
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
`;
|
|
875
|
-
const response = await this.request(query, { outletId, servingDate, timeslotType });
|
|
876
|
-
return response.menus;
|
|
877
|
-
}
|
|
878
|
-
async getOptimizedMenus(outletId, servingDate) {
|
|
879
|
-
const query = `
|
|
880
|
-
query GetOptimisedMenus($outletId: Int!, $servingDate: ISO8601Date!) {
|
|
881
|
-
menusOptimised(outletId: $outletId, servingDate: $servingDate) {
|
|
882
|
-
id
|
|
883
|
-
label
|
|
884
|
-
startDate
|
|
885
|
-
endDate
|
|
886
|
-
sections {
|
|
887
|
-
id
|
|
888
|
-
label
|
|
889
|
-
description
|
|
890
|
-
displayOrder
|
|
891
|
-
items {
|
|
892
|
-
id
|
|
893
|
-
label
|
|
894
|
-
description
|
|
895
|
-
displayOrder
|
|
896
|
-
unitPriceFractional
|
|
897
|
-
currency
|
|
898
|
-
isConfigurable
|
|
899
|
-
horizontalImageUrl
|
|
900
|
-
idBreadcrumb
|
|
901
|
-
modifierGroups {
|
|
902
|
-
id
|
|
903
|
-
label
|
|
904
|
-
selectionRequiredMin
|
|
905
|
-
selectionRequiredMax
|
|
906
|
-
displayOrder
|
|
907
|
-
isFixed
|
|
908
|
-
maxQuantityPerModifier
|
|
909
|
-
idBreadcrumb
|
|
910
|
-
modifiers {
|
|
911
|
-
id
|
|
912
|
-
label
|
|
913
|
-
description
|
|
914
|
-
displayOrder
|
|
915
|
-
itemId
|
|
916
|
-
unitPriceFractional
|
|
917
|
-
currency
|
|
918
|
-
isConfigurable
|
|
919
|
-
horizontalImageUrl
|
|
920
|
-
idBreadcrumb
|
|
921
|
-
defaultQuantity
|
|
922
|
-
unitLabel
|
|
923
|
-
perUnitQuantity
|
|
924
|
-
modifierGroups {
|
|
925
|
-
id
|
|
926
|
-
label
|
|
927
|
-
selectionRequiredMin
|
|
928
|
-
selectionRequiredMax
|
|
929
|
-
displayOrder
|
|
930
|
-
isFixed
|
|
931
|
-
maxQuantityPerModifier
|
|
932
|
-
idBreadcrumb
|
|
933
|
-
modifiers {
|
|
934
|
-
id
|
|
935
|
-
label
|
|
936
|
-
description
|
|
937
|
-
displayOrder
|
|
938
|
-
itemId
|
|
939
|
-
unitPriceFractional
|
|
940
|
-
currency
|
|
941
|
-
isConfigurable
|
|
942
|
-
horizontalImageUrl
|
|
943
|
-
idBreadcrumb
|
|
944
|
-
defaultQuantity
|
|
945
|
-
unitLabel
|
|
946
|
-
perUnitQuantity
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
subSections {
|
|
953
|
-
id
|
|
954
|
-
label
|
|
955
|
-
description
|
|
956
|
-
displayOrder
|
|
957
|
-
items {
|
|
958
|
-
id
|
|
959
|
-
label
|
|
960
|
-
description
|
|
961
|
-
displayOrder
|
|
962
|
-
unitPriceFractional
|
|
963
|
-
currency
|
|
964
|
-
isConfigurable
|
|
965
|
-
horizontalImageUrl
|
|
966
|
-
idBreadcrumb
|
|
967
|
-
modifierGroups {
|
|
968
|
-
id
|
|
969
|
-
label
|
|
970
|
-
selectionRequiredMin
|
|
971
|
-
selectionRequiredMax
|
|
972
|
-
displayOrder
|
|
973
|
-
isFixed
|
|
974
|
-
maxQuantityPerModifier
|
|
975
|
-
idBreadcrumb
|
|
976
|
-
modifiers {
|
|
977
|
-
id
|
|
978
|
-
label
|
|
979
|
-
description
|
|
980
|
-
displayOrder
|
|
981
|
-
itemId
|
|
982
|
-
unitPriceFractional
|
|
983
|
-
currency
|
|
984
|
-
isConfigurable
|
|
985
|
-
horizontalImageUrl
|
|
986
|
-
idBreadcrumb
|
|
987
|
-
defaultQuantity
|
|
988
|
-
unitLabel
|
|
989
|
-
perUnitQuantity
|
|
990
|
-
modifierGroups {
|
|
991
|
-
id
|
|
992
|
-
label
|
|
993
|
-
selectionRequiredMin
|
|
994
|
-
selectionRequiredMax
|
|
995
|
-
displayOrder
|
|
996
|
-
isFixed
|
|
997
|
-
maxQuantityPerModifier
|
|
998
|
-
idBreadcrumb
|
|
999
|
-
modifiers {
|
|
1000
|
-
id
|
|
1001
|
-
label
|
|
1002
|
-
description
|
|
1003
|
-
displayOrder
|
|
1004
|
-
itemId
|
|
1005
|
-
unitPriceFractional
|
|
1006
|
-
currency
|
|
1007
|
-
isConfigurable
|
|
1008
|
-
horizontalImageUrl
|
|
1009
|
-
idBreadcrumb
|
|
1010
|
-
defaultQuantity
|
|
1011
|
-
unitLabel
|
|
1012
|
-
perUnitQuantity
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
`;
|
|
1023
|
-
const response = await this.request(query, { outletId, servingDate });
|
|
1024
|
-
return response.menusOptimised;
|
|
1025
|
-
}
|
|
1026
384
|
async getItems(filter) {
|
|
1027
385
|
const query = `
|
|
1028
386
|
query GetItems($filter: ItemFilter) {
|
|
@@ -1036,39 +394,14 @@ export class AtlasClient {
|
|
|
1036
394
|
archivedAt
|
|
1037
395
|
identifier
|
|
1038
396
|
label
|
|
1039
|
-
internalLabel
|
|
1040
397
|
description
|
|
1041
398
|
unitPriceFractional
|
|
1042
|
-
unitCostFractional
|
|
1043
|
-
unitLabel
|
|
1044
|
-
perUnitQuantity
|
|
1045
399
|
currency
|
|
1046
|
-
serviceChargeable
|
|
1047
400
|
isConfigurable
|
|
1048
401
|
horizontalImageUrl
|
|
1049
402
|
brandId
|
|
1050
|
-
kitchenTagList
|
|
1051
403
|
tagList
|
|
1052
404
|
reportCategory
|
|
1053
|
-
promotionalLabelText
|
|
1054
|
-
promotionalLabelFontColor
|
|
1055
|
-
promotionalLabelBgColor
|
|
1056
|
-
availabilityConditionGroups {
|
|
1057
|
-
id
|
|
1058
|
-
startDate
|
|
1059
|
-
endDate
|
|
1060
|
-
hidden
|
|
1061
|
-
disabledReason
|
|
1062
|
-
availableByDefault
|
|
1063
|
-
availabilityConditions {
|
|
1064
|
-
id
|
|
1065
|
-
outletIds
|
|
1066
|
-
daysOfWeek
|
|
1067
|
-
fulfilmentTypes
|
|
1068
|
-
startTime
|
|
1069
|
-
endTime
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
405
|
}
|
|
1073
406
|
}
|
|
1074
407
|
}
|
|
@@ -1101,42 +434,20 @@ export class AtlasClient {
|
|
|
1101
434
|
const response = await this.request(query, { filters, dateRange, dateRangeType: "ORDER_SERVING_DATE" });
|
|
1102
435
|
return response.getSalesSummaryReport;
|
|
1103
436
|
}
|
|
1104
|
-
async
|
|
437
|
+
async getOutlets() {
|
|
1105
438
|
const query = `
|
|
1106
|
-
query
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
$itemTagIds: [Int!]
|
|
1114
|
-
$searchQuery: String
|
|
1115
|
-
$itemsToVisualize: [String!]
|
|
1116
|
-
) {
|
|
1117
|
-
getProductInsights(
|
|
1118
|
-
brandIds: $brandIds
|
|
1119
|
-
outletIds: $outletIds
|
|
1120
|
-
itemTypes: $itemTypes
|
|
1121
|
-
fulfilmentTypes: $fulfilmentTypes
|
|
1122
|
-
servingDateBetween: $servingDateBetween
|
|
1123
|
-
sources: $sources
|
|
1124
|
-
itemTagIds: $itemTagIds
|
|
1125
|
-
searchQuery: $searchQuery
|
|
1126
|
-
itemsToVisualize: $itemsToVisualize
|
|
1127
|
-
) {
|
|
1128
|
-
top20ProductsByCount
|
|
1129
|
-
top20ProductsBySales
|
|
1130
|
-
bottom20ProductsByCount
|
|
1131
|
-
bottom20ProductsBySales
|
|
1132
|
-
allItemsByPopularity
|
|
1133
|
-
allProductsPurchased
|
|
1134
|
-
rawData
|
|
439
|
+
query GetOutlets {
|
|
440
|
+
outlets {
|
|
441
|
+
id
|
|
442
|
+
identifier
|
|
443
|
+
label
|
|
444
|
+
archived
|
|
445
|
+
config
|
|
1135
446
|
}
|
|
1136
447
|
}
|
|
1137
448
|
`;
|
|
1138
|
-
const response = await this.request(query,
|
|
1139
|
-
return response.
|
|
449
|
+
const response = await this.request(query, {});
|
|
450
|
+
return response.outlets;
|
|
1140
451
|
}
|
|
1141
452
|
}
|
|
1142
453
|
//# sourceMappingURL=client.js.map
|