@compassdigital/sdk.typescript 3.7.0 → 3.9.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/bin/gen.js +5 -0
- package/gen.ts +5 -0
- package/lib/base.d.ts.map +1 -1
- package/lib/base.js +5 -2
- package/lib/base.js.map +1 -1
- package/lib/index.d.ts +2 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -10
- package/lib/index.js.map +1 -1
- package/lib/interface/location.d.ts +17 -4
- package/lib/interface/location.d.ts.map +1 -1
- package/lib/interface/menu.d.ts +5 -1
- package/lib/interface/menu.d.ts.map +1 -1
- package/lib/interface/message.d.ts +6 -2
- package/lib/interface/message.d.ts.map +1 -1
- package/lib/interface/order.d.ts +4 -1
- package/lib/interface/order.d.ts.map +1 -1
- package/lib/interface/partner.d.ts +4 -5
- package/lib/interface/partner.d.ts.map +1 -1
- package/lib/interface/payment.d.ts +4 -4
- package/lib/interface/payment.d.ts.map +1 -1
- package/lib/interface/permission.d.ts +6 -2
- package/lib/interface/permission.d.ts.map +1 -1
- package/lib/interface/shoppingcart.d.ts +0 -4
- package/lib/interface/shoppingcart.d.ts.map +1 -1
- package/lib/interface/task.d.ts +10 -22
- package/lib/interface/task.d.ts.map +1 -1
- package/lib/interface/vendor.d.ts +1 -0
- package/lib/interface/vendor.d.ts.map +1 -1
- package/lib/interface/vote.d.ts +6 -2
- package/lib/interface/vote.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/base.ts +4 -2
- package/src/index.ts +1 -16
- package/src/interface/announcement.ts +1 -1
- package/src/interface/location.ts +21 -4
- package/src/interface/menu.ts +5 -1
- package/src/interface/message.ts +6 -2
- package/src/interface/order.ts +4 -1
- package/src/interface/partner.ts +5 -6
- package/src/interface/payment.ts +4 -4
- package/src/interface/permission.ts +6 -2
- package/src/interface/shoppingcart.ts +0 -5
- package/src/interface/task.ts +11 -28
- package/src/interface/vendor.ts +1 -0
- package/src/interface/vote.ts +6 -2
- package/test/client.test.ts +17 -6
package/src/interface/payment.ts
CHANGED
|
@@ -311,7 +311,7 @@ export interface PostPaymentTokenBody {
|
|
|
311
311
|
// Name on credit card
|
|
312
312
|
nameOnCard: string;
|
|
313
313
|
// FP StoreId
|
|
314
|
-
storeId:
|
|
314
|
+
storeId: any[];
|
|
315
315
|
// FP TerminalId
|
|
316
316
|
terminalId: string;
|
|
317
317
|
}
|
|
@@ -328,7 +328,7 @@ export interface PutPaymentTokenBody {
|
|
|
328
328
|
// Token information to be saved
|
|
329
329
|
updatedTokenInfo: UpdateTokenInformation;
|
|
330
330
|
// FP StoreId
|
|
331
|
-
storeId:
|
|
331
|
+
storeId: any[];
|
|
332
332
|
// FP TerminalId
|
|
333
333
|
terminalId: string;
|
|
334
334
|
}
|
|
@@ -345,7 +345,7 @@ export interface DeletePaymentTokenBody {
|
|
|
345
345
|
// Token string to be deleted
|
|
346
346
|
token: string;
|
|
347
347
|
// FP StoreId
|
|
348
|
-
storeId:
|
|
348
|
+
storeId: any[];
|
|
349
349
|
// FP TerminalId
|
|
350
350
|
terminalId: string;
|
|
351
351
|
}
|
|
@@ -360,7 +360,7 @@ export interface DeletePaymentTokenRequest {
|
|
|
360
360
|
|
|
361
361
|
export interface GetPaymentMethodsQuery {
|
|
362
362
|
// FP StoreId
|
|
363
|
-
storeId:
|
|
363
|
+
storeId: any[];
|
|
364
364
|
// FP TerminalId
|
|
365
365
|
terminalId: string;
|
|
366
366
|
}
|
|
@@ -86,7 +86,9 @@ export interface RoleAssignmentBody {
|
|
|
86
86
|
// role
|
|
87
87
|
role_id: string;
|
|
88
88
|
recipient_id: string;
|
|
89
|
-
meta?:
|
|
89
|
+
meta?: {
|
|
90
|
+
[index: string]: any;
|
|
91
|
+
};
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
export interface RoleAssignment {
|
|
@@ -95,7 +97,9 @@ export interface RoleAssignment {
|
|
|
95
97
|
// role
|
|
96
98
|
role_id: string;
|
|
97
99
|
recipient_id: string;
|
|
98
|
-
meta?:
|
|
100
|
+
meta?: {
|
|
101
|
+
[index: string]: any;
|
|
102
|
+
};
|
|
99
103
|
last_updated_by?: string;
|
|
100
104
|
date_created?: string;
|
|
101
105
|
date_modified?: string;
|
|
@@ -221,11 +221,6 @@ export interface ShoppingCart {
|
|
|
221
221
|
// If an order should be paid with meal exchange. If true, this will calculate meals total.
|
|
222
222
|
mx_cart?: boolean;
|
|
223
223
|
};
|
|
224
|
-
meta?: {
|
|
225
|
-
// Raw request from any vendor integrated with CDL
|
|
226
|
-
vendor?: any;
|
|
227
|
-
[index: string]: any;
|
|
228
|
-
};
|
|
229
224
|
}
|
|
230
225
|
|
|
231
226
|
// POST /shoppingcart/ - Create a new ShoppingCart
|
package/src/interface/task.ts
CHANGED
|
@@ -45,11 +45,15 @@ export interface Task {
|
|
|
45
45
|
// Task Status
|
|
46
46
|
status?: string;
|
|
47
47
|
// Any related metadata information about this Task
|
|
48
|
-
meta?:
|
|
48
|
+
meta?: {
|
|
49
|
+
[index: string]: any;
|
|
50
|
+
};
|
|
49
51
|
// Date when Task was created
|
|
50
52
|
created?: string;
|
|
51
53
|
// Date when task was last modified
|
|
52
54
|
modified?: string;
|
|
55
|
+
// Date when Task is scheduled to start
|
|
56
|
+
scheduled_start?: string;
|
|
53
57
|
// Date when task is out for delivery
|
|
54
58
|
started?: string;
|
|
55
59
|
// Date when task was delivered
|
|
@@ -87,7 +91,9 @@ export interface TaskCreate {
|
|
|
87
91
|
// Task Status
|
|
88
92
|
status: string;
|
|
89
93
|
// Any related metadata information about this Task
|
|
90
|
-
meta?:
|
|
94
|
+
meta?: {
|
|
95
|
+
[index: string]: any;
|
|
96
|
+
};
|
|
91
97
|
// Task Type
|
|
92
98
|
type: string;
|
|
93
99
|
}
|
|
@@ -112,7 +118,9 @@ export interface TaskUpdate {
|
|
|
112
118
|
// Task Status
|
|
113
119
|
status?: string;
|
|
114
120
|
// Any related metadata information about this Task
|
|
115
|
-
meta?:
|
|
121
|
+
meta?: {
|
|
122
|
+
[index: string]: any;
|
|
123
|
+
};
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
export interface OrderUpdate {
|
|
@@ -124,21 +132,6 @@ export interface ActionResponse {
|
|
|
124
132
|
success?: boolean;
|
|
125
133
|
}
|
|
126
134
|
|
|
127
|
-
export interface SNSMessage {
|
|
128
|
-
Type: string;
|
|
129
|
-
MessageId: string;
|
|
130
|
-
Token?: string;
|
|
131
|
-
TopicArn: string;
|
|
132
|
-
Message: string;
|
|
133
|
-
SubscribeURL?: string;
|
|
134
|
-
Timestamp: string;
|
|
135
|
-
SignatureVersion: string;
|
|
136
|
-
Signature: string;
|
|
137
|
-
SigningCertURL: string;
|
|
138
|
-
Subject?: string;
|
|
139
|
-
UnsubscribeURL?: string;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
135
|
// POST /task/ - Create new Task
|
|
143
136
|
|
|
144
137
|
export type PostTaskBody = TaskCreate;
|
|
@@ -306,13 +299,3 @@ export type GetTaskLocationGroupResponse = Tasks;
|
|
|
306
299
|
export interface GetTaskLocationGroupRequest
|
|
307
300
|
extends GetTaskLocationGroupQuery,
|
|
308
301
|
GetTaskLocationGroupPath {}
|
|
309
|
-
|
|
310
|
-
// POST /task/apex/sns - Update apex integrated task
|
|
311
|
-
|
|
312
|
-
export type PostTaskApexSnsBody = SNSMessage;
|
|
313
|
-
|
|
314
|
-
export type PostTaskApexSnsResponse = ActionResponse;
|
|
315
|
-
|
|
316
|
-
export interface PostTaskApexSnsRequest {
|
|
317
|
-
body: PostTaskApexSnsBody;
|
|
318
|
-
}
|
package/src/interface/vendor.ts
CHANGED
package/src/interface/vote.ts
CHANGED
|
@@ -16,7 +16,9 @@ export interface CreateVote {
|
|
|
16
16
|
skip?: boolean;
|
|
17
17
|
idfa?: string;
|
|
18
18
|
session_start_time?: number;
|
|
19
|
-
meta?:
|
|
19
|
+
meta?: {
|
|
20
|
+
[index: string]: any;
|
|
21
|
+
};
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export interface Vote {
|
|
@@ -32,7 +34,9 @@ export interface Vote {
|
|
|
32
34
|
skip?: boolean;
|
|
33
35
|
idfa?: string;
|
|
34
36
|
session_start_time?: string;
|
|
35
|
-
meta?:
|
|
37
|
+
meta?: {
|
|
38
|
+
[index: string]: any;
|
|
39
|
+
};
|
|
36
40
|
timestamp?: string;
|
|
37
41
|
}
|
|
38
42
|
|
package/test/client.test.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { parse as parseURL } from "url";
|
|
3
|
+
import { ServiceClient, ResponseData, ServiceError, InterceptFn } from "../src";
|
|
3
4
|
import { Task } from "../src/interface/task";
|
|
4
5
|
|
|
5
6
|
describe("ServiceClient", () => {
|
|
@@ -16,7 +17,7 @@ describe("ServiceClient", () => {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function interceptor(status: number, body?: any, err?: any): InterceptFn {
|
|
19
|
-
return (
|
|
20
|
+
return () => Promise.resolve(response(status, body, err));
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
test("makes basic request", async () => {
|
|
@@ -71,26 +72,26 @@ describe("ServiceClient", () => {
|
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
test("client retries on bad status codes", async () => {
|
|
74
|
-
const intercept = jest.fn(async (
|
|
75
|
+
const intercept = jest.fn(async () => {
|
|
75
76
|
if (intercept.mock.calls.length === 3) {
|
|
76
77
|
return response(200, "{}");
|
|
77
78
|
}
|
|
78
79
|
return response(500, "something went wrong");
|
|
79
80
|
});
|
|
80
81
|
const api = new ServiceClient({ intercept });
|
|
81
|
-
|
|
82
|
+
await api.get_task("", { retry: 2 });
|
|
82
83
|
expect(intercept.mock.calls.length).toBe(3);
|
|
83
84
|
});
|
|
84
85
|
|
|
85
86
|
test("client retries on network error", async () => {
|
|
86
|
-
const intercept = jest.fn(async (
|
|
87
|
+
const intercept = jest.fn(async () => {
|
|
87
88
|
if (intercept.mock.calls.length === 3) {
|
|
88
89
|
return response(200, "{}");
|
|
89
90
|
}
|
|
90
91
|
return response(0, "", new Error("network error"));
|
|
91
92
|
});
|
|
92
93
|
const api = new ServiceClient({ intercept });
|
|
93
|
-
|
|
94
|
+
await api.get_task("", { retry: 2 });
|
|
94
95
|
expect(intercept.mock.calls.length).toBe(3);
|
|
95
96
|
});
|
|
96
97
|
|
|
@@ -102,6 +103,16 @@ describe("ServiceClient", () => {
|
|
|
102
103
|
expect(intercept.mock.calls.length).toEqual(6);
|
|
103
104
|
});
|
|
104
105
|
|
|
106
|
+
test("array query parameters are passed correctly", async () => {
|
|
107
|
+
const intercept = jest.fn(interceptor(200, {}));
|
|
108
|
+
const api = new ServiceClient({ intercept });
|
|
109
|
+
await api.get_menus({ query: { foo: "test", things: [1, 2, 3] }} as any);
|
|
110
|
+
expect(intercept.mock.calls.length).toBe(1);
|
|
111
|
+
const req = intercept.mock.calls[0][0];
|
|
112
|
+
const { query } = parseURL(req.url, true);
|
|
113
|
+
expect(query).toEqual({ foo: "test", things: ["1","2","3"] });
|
|
114
|
+
});
|
|
115
|
+
|
|
105
116
|
describe("ServiceError", () => {
|
|
106
117
|
|
|
107
118
|
// see: https://github.com/microsoft/TypeScript/issues/13965
|