masterypath-sdk 0.0.13 → 0.1.2
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/dist/MasterypathSDK.d.ts +8 -8
- package/dist/MasterypathSDK.js +8 -8
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/commands/chat.d.ts.map +1 -1
- package/dist/cli/commands/chat.js +10 -5
- package/dist/cli/commands/chat.js.map +1 -1
- package/dist/cli/commands/organizations.d.ts.map +1 -1
- package/dist/cli/commands/organizations.js +9 -70
- package/dist/cli/commands/organizations.js.map +1 -1
- package/dist/cli/commands/uploads.d.ts +2 -2
- package/dist/cli/commands/uploads.d.ts.map +1 -1
- package/dist/cli/commands/uploads.js +8 -8
- package/dist/cli/commands/uploads.js.map +1 -1
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -13
- package/dist/cli/output.js.map +1 -1
- package/dist/domains/chat/ChatClient.d.ts +8 -8
- package/dist/domains/chat/ChatClient.d.ts.map +1 -1
- package/dist/domains/chat/ChatClient.js +24 -16
- package/dist/domains/chat/ChatClient.js.map +1 -1
- package/dist/domains/chat/types.d.ts +6 -0
- package/dist/domains/chat/types.d.ts.map +1 -1
- package/dist/domains/containers/ContainersClient.d.ts +187 -63
- package/dist/domains/containers/ContainersClient.js +542 -376
- package/dist/domains/index.d.ts +9 -9
- package/dist/domains/index.d.ts.map +1 -1
- package/dist/domains/index.js +5 -5
- package/dist/domains/listings/ListingsClient.d.ts +35 -12
- package/dist/domains/listings/ListingsClient.js +100 -84
- package/dist/domains/merchants/MerchantsClient.d.ts +124 -31
- package/dist/domains/merchants/MerchantsClient.js +420 -303
- package/dist/domains/mindmaps/MindmapsClient.d.ts +6 -6
- package/dist/domains/mindmaps/MindmapsClient.d.ts.map +1 -1
- package/dist/domains/mindmaps/MindmapsClient.js +12 -13
- package/dist/domains/mindmaps/MindmapsClient.js.map +1 -1
- package/dist/domains/mindmaps/types.d.ts.map +1 -1
- package/dist/domains/orders/OrdersClient.d.ts +327 -94
- package/dist/domains/orders/OrdersClient.js +934 -662
- package/dist/domains/orders/types.d.ts +45 -36
- package/dist/domains/orders/types.js +1 -1
- package/dist/domains/organizations/OrganizationsClient.d.ts +8 -5
- package/dist/domains/organizations/OrganizationsClient.d.ts.map +1 -1
- package/dist/domains/organizations/OrganizationsClient.js +21 -30
- package/dist/domains/organizations/OrganizationsClient.js.map +1 -1
- package/dist/domains/plants/PlantsClient.d.ts +43 -28
- package/dist/domains/plants/PlantsClient.js +51 -47
- package/dist/domains/products/ProductsClient.d.ts +34 -12
- package/dist/domains/products/ProductsClient.js +94 -83
- package/dist/domains/public-api/PublicApiClient.d.ts +22 -0
- package/dist/domains/public-api/PublicApiClient.d.ts.map +1 -1
- package/dist/domains/public-api/PublicApiClient.js +51 -0
- package/dist/domains/public-api/PublicApiClient.js.map +1 -1
- package/dist/domains/uploads/UploadsClient.d.ts.map +1 -1
- package/dist/domains/uploads/UploadsClient.js +1 -3
- package/dist/domains/uploads/UploadsClient.js.map +1 -1
- package/dist/domains/usdazones/UsdazonesClient.d.ts +6 -6
- package/dist/domains/usdazones/UsdazonesClient.js +15 -15
- package/dist/domains/users/UsersClient.d.ts +4 -4
- package/dist/domains/users/UsersClient.d.ts.map +1 -1
- package/dist/domains/users/UsersClient.js +24 -22
- package/dist/domains/users/UsersClient.js.map +1 -1
- package/dist/generated/graphql.d.ts +1172 -1079
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5622 -84
- package/dist/generated/graphql.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/shared/fulfillmentWindows.js +4 -4
- package/dist/utils/errors.js +3 -3
- package/package.json +1 -1
|
@@ -1,404 +1,570 @@
|
|
|
1
|
-
import { print } from
|
|
2
|
-
import {
|
|
1
|
+
import { print } from "graphql";
|
|
2
|
+
import {
|
|
3
|
+
CreateContainerDocument,
|
|
4
|
+
CreateContainerAndIterationDocument,
|
|
5
|
+
UpdateRectangularContainerDocument,
|
|
6
|
+
UpdateCircularContainerDocument,
|
|
7
|
+
DeleteContainerDocument,
|
|
8
|
+
GetContainerDocument,
|
|
9
|
+
GetContainersDocument,
|
|
10
|
+
GetContainersWithCurrentIterationDocument,
|
|
11
|
+
CreateIterationDocument,
|
|
12
|
+
UpdateIterationDocument,
|
|
13
|
+
DeleteIterationDocument,
|
|
14
|
+
AddPlantToIterationDocument,
|
|
15
|
+
UpdatePlantQtyInIterationDocument,
|
|
16
|
+
RemovePlantFromIterationDocument,
|
|
17
|
+
RotateContainerDocument,
|
|
18
|
+
CreateSoilTestDocument,
|
|
19
|
+
ListSoilTestsByContainerDocument,
|
|
20
|
+
ListSoilTestsByIterationDocument,
|
|
21
|
+
DeleteSoilTestDocument,
|
|
22
|
+
CreateContainerLogDocument,
|
|
23
|
+
GetContainerLogsDocument,
|
|
24
|
+
UpdateContainerLogDocument,
|
|
25
|
+
CreateTaskDocument,
|
|
26
|
+
UpdateTaskDocument,
|
|
27
|
+
DeleteTaskDocument,
|
|
28
|
+
ListTasksDocument,
|
|
29
|
+
ListAllUserTasksDocument,
|
|
30
|
+
ListIterationPlantsDocument,
|
|
31
|
+
} from "../../generated/graphql";
|
|
3
32
|
export class ContainersClient {
|
|
4
|
-
|
|
5
|
-
|
|
33
|
+
constructor(httpClient) {
|
|
34
|
+
this.httpClient = httpClient;
|
|
35
|
+
}
|
|
36
|
+
async createContainer(
|
|
37
|
+
name,
|
|
38
|
+
kind,
|
|
39
|
+
length,
|
|
40
|
+
width,
|
|
41
|
+
diameter,
|
|
42
|
+
locationId,
|
|
43
|
+
merchantId,
|
|
44
|
+
) {
|
|
45
|
+
const response = await this.httpClient.request(
|
|
46
|
+
"/graphql-containers",
|
|
47
|
+
{
|
|
48
|
+
query: print(CreateContainerDocument),
|
|
49
|
+
variables: {
|
|
50
|
+
name,
|
|
51
|
+
kind,
|
|
52
|
+
length,
|
|
53
|
+
width,
|
|
54
|
+
diameter,
|
|
55
|
+
locationId,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
merchantId,
|
|
59
|
+
);
|
|
60
|
+
if (!response.data?.createContainer) {
|
|
61
|
+
throw new Error("Failed to create container: No data returned");
|
|
6
62
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
63
|
+
return response.data.createContainer;
|
|
64
|
+
}
|
|
65
|
+
async createContainerAndIteration(
|
|
66
|
+
name,
|
|
67
|
+
kind,
|
|
68
|
+
iterationName,
|
|
69
|
+
startDate,
|
|
70
|
+
length,
|
|
71
|
+
width,
|
|
72
|
+
diameter,
|
|
73
|
+
locationId,
|
|
74
|
+
merchantId,
|
|
75
|
+
) {
|
|
76
|
+
const response = await this.httpClient.request(
|
|
77
|
+
"/graphql-containers",
|
|
78
|
+
{
|
|
79
|
+
query: print(CreateContainerAndIterationDocument),
|
|
80
|
+
variables: {
|
|
81
|
+
name,
|
|
82
|
+
kind,
|
|
83
|
+
iterationName,
|
|
84
|
+
startDate,
|
|
85
|
+
length,
|
|
86
|
+
width,
|
|
87
|
+
diameter,
|
|
88
|
+
locationId,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
merchantId,
|
|
92
|
+
);
|
|
93
|
+
if (!response.data?.createContainerAndIteration) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
"Failed to create container and iteration: No data returned",
|
|
96
|
+
);
|
|
23
97
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
98
|
+
return response.data.createContainerAndIteration;
|
|
99
|
+
}
|
|
100
|
+
async updateContainer(
|
|
101
|
+
id,
|
|
102
|
+
name,
|
|
103
|
+
kind,
|
|
104
|
+
length,
|
|
105
|
+
width,
|
|
106
|
+
diameter,
|
|
107
|
+
locationId,
|
|
108
|
+
merchantId,
|
|
109
|
+
) {
|
|
110
|
+
if (diameter !== undefined && length === undefined && width === undefined) {
|
|
111
|
+
const response = await this.httpClient.request(
|
|
112
|
+
"/graphql-containers",
|
|
113
|
+
{
|
|
114
|
+
query: print(UpdateCircularContainerDocument),
|
|
115
|
+
variables: {
|
|
116
|
+
id,
|
|
117
|
+
name,
|
|
118
|
+
kind,
|
|
119
|
+
diameter,
|
|
120
|
+
locationId,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
merchantId,
|
|
124
|
+
);
|
|
125
|
+
if (!response.data?.updateContainer) {
|
|
126
|
+
throw new Error("Failed to update container: No data returned");
|
|
127
|
+
}
|
|
128
|
+
return response.data.updateContainer;
|
|
129
|
+
} else {
|
|
130
|
+
const response = await this.httpClient.request(
|
|
131
|
+
"/graphql-containers",
|
|
132
|
+
{
|
|
133
|
+
query: print(UpdateRectangularContainerDocument),
|
|
134
|
+
variables: {
|
|
135
|
+
id,
|
|
136
|
+
name,
|
|
137
|
+
kind,
|
|
138
|
+
length,
|
|
139
|
+
width,
|
|
140
|
+
locationId,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
merchantId,
|
|
144
|
+
);
|
|
145
|
+
if (!response.data?.updateContainer) {
|
|
146
|
+
throw new Error("Failed to update container: No data returned");
|
|
147
|
+
}
|
|
148
|
+
return response.data.updateContainer;
|
|
42
149
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
else {
|
|
61
|
-
const response = await this.httpClient.request('/graphql-containers', {
|
|
62
|
-
query: print(UpdateRectangularContainerDocument),
|
|
63
|
-
variables: {
|
|
64
|
-
id,
|
|
65
|
-
name,
|
|
66
|
-
kind,
|
|
67
|
-
length,
|
|
68
|
-
width,
|
|
69
|
-
locationId,
|
|
70
|
-
},
|
|
71
|
-
}, merchantId);
|
|
72
|
-
if (!response.data?.updateContainer) {
|
|
73
|
-
throw new Error('Failed to update container: No data returned');
|
|
74
|
-
}
|
|
75
|
-
return response.data.updateContainer;
|
|
76
|
-
}
|
|
150
|
+
}
|
|
151
|
+
async deleteContainer(id, merchantId) {
|
|
152
|
+
const response = await this.httpClient.request(
|
|
153
|
+
"/graphql-containers",
|
|
154
|
+
{
|
|
155
|
+
query: print(DeleteContainerDocument),
|
|
156
|
+
variables: {
|
|
157
|
+
id,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
merchantId,
|
|
161
|
+
);
|
|
162
|
+
if (
|
|
163
|
+
response.data?.deleteContainer === undefined ||
|
|
164
|
+
response.data.deleteContainer === null
|
|
165
|
+
) {
|
|
166
|
+
throw new Error("Failed to delete container: No data returned");
|
|
77
167
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
168
|
+
return response.data.deleteContainer;
|
|
169
|
+
}
|
|
170
|
+
async getContainer(id, merchantId) {
|
|
171
|
+
const response = await this.httpClient.request(
|
|
172
|
+
"/graphql-containers",
|
|
173
|
+
{
|
|
174
|
+
query: print(GetContainerDocument),
|
|
175
|
+
variables: {
|
|
176
|
+
id,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
merchantId,
|
|
180
|
+
);
|
|
181
|
+
return response.data?.getContainer ?? null;
|
|
182
|
+
}
|
|
183
|
+
async getAllContainers(merchantId) {
|
|
184
|
+
const response = await this.httpClient.request(
|
|
185
|
+
"/graphql-containers",
|
|
186
|
+
{
|
|
187
|
+
query: print(GetContainersDocument),
|
|
188
|
+
variables: {},
|
|
189
|
+
},
|
|
190
|
+
merchantId,
|
|
191
|
+
);
|
|
192
|
+
if (!response.data?.getAllContainers) {
|
|
193
|
+
throw new Error("Failed to get containers: No data returned");
|
|
89
194
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
195
|
+
return response.data.getAllContainers;
|
|
196
|
+
}
|
|
197
|
+
async listContainersWithCurrentIteration(merchantId) {
|
|
198
|
+
const response = await this.httpClient.request(
|
|
199
|
+
"/graphql-containers",
|
|
200
|
+
{
|
|
201
|
+
query: print(GetContainersWithCurrentIterationDocument),
|
|
202
|
+
variables: {},
|
|
203
|
+
},
|
|
204
|
+
merchantId,
|
|
205
|
+
);
|
|
206
|
+
if (!response.data?.listContainersWithCurrentIteration) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
"Failed to list containers with current iteration: No data returned",
|
|
209
|
+
);
|
|
98
210
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
211
|
+
return response.data.listContainersWithCurrentIteration;
|
|
212
|
+
}
|
|
213
|
+
async createIteration(containerId, startDate, name, phase, note, endDate) {
|
|
214
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
215
|
+
query: print(CreateIterationDocument),
|
|
216
|
+
variables: {
|
|
217
|
+
containerId,
|
|
218
|
+
startDate,
|
|
219
|
+
name,
|
|
220
|
+
phase,
|
|
221
|
+
note,
|
|
222
|
+
endDate,
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
if (!response.data?.createIteration) {
|
|
226
|
+
throw new Error("Failed to create iteration: No data returned");
|
|
108
227
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
228
|
+
return response.data.createIteration;
|
|
229
|
+
}
|
|
230
|
+
async updateIteration(id, name, phase, note, endDate) {
|
|
231
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
232
|
+
query: print(UpdateIterationDocument),
|
|
233
|
+
variables: {
|
|
234
|
+
id,
|
|
235
|
+
name,
|
|
236
|
+
phase,
|
|
237
|
+
note,
|
|
238
|
+
endDate,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
if (!response.data?.updateIteration) {
|
|
242
|
+
throw new Error("Failed to update iteration: No data returned");
|
|
118
243
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
return response.data.createIteration;
|
|
244
|
+
return response.data.updateIteration;
|
|
245
|
+
}
|
|
246
|
+
async deleteIteration(id) {
|
|
247
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
248
|
+
query: print(DeleteIterationDocument),
|
|
249
|
+
variables: {
|
|
250
|
+
id,
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
if (
|
|
254
|
+
response.data?.deleteIteration === undefined ||
|
|
255
|
+
response.data.deleteIteration === null
|
|
256
|
+
) {
|
|
257
|
+
throw new Error("Failed to delete iteration: No data returned");
|
|
135
258
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
259
|
+
return response.data.deleteIteration;
|
|
260
|
+
}
|
|
261
|
+
async addPlantToIteration(iterationId, plantId, qty) {
|
|
262
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
263
|
+
query: print(AddPlantToIterationDocument),
|
|
264
|
+
variables: {
|
|
265
|
+
iterationId,
|
|
266
|
+
plantId,
|
|
267
|
+
qty,
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
if (
|
|
271
|
+
response.data?.addPlantToIteration === undefined ||
|
|
272
|
+
response.data.addPlantToIteration === null
|
|
273
|
+
) {
|
|
274
|
+
throw new Error("Failed to add plant to iteration: No data returned");
|
|
151
275
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
276
|
+
return response.data.addPlantToIteration;
|
|
277
|
+
}
|
|
278
|
+
async updatePlantQtyInIteration(iterationId, plantId, qty) {
|
|
279
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
280
|
+
query: print(UpdatePlantQtyInIterationDocument),
|
|
281
|
+
variables: {
|
|
282
|
+
iterationId,
|
|
283
|
+
plantId,
|
|
284
|
+
qty,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
if (
|
|
288
|
+
response.data?.updatePlantQtyInIteration === undefined ||
|
|
289
|
+
response.data.updatePlantQtyInIteration === null
|
|
290
|
+
) {
|
|
291
|
+
throw new Error(
|
|
292
|
+
"Failed to update plant quantity in iteration: No data returned",
|
|
293
|
+
);
|
|
163
294
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
295
|
+
return response.data.updatePlantQtyInIteration;
|
|
296
|
+
}
|
|
297
|
+
async removePlantFromIteration(iterationId, plantId) {
|
|
298
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
299
|
+
query: print(RemovePlantFromIterationDocument),
|
|
300
|
+
variables: {
|
|
301
|
+
iterationId,
|
|
302
|
+
plantId,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
if (
|
|
306
|
+
response.data?.removePlantFromIteration === undefined ||
|
|
307
|
+
response.data.removePlantFromIteration === null
|
|
308
|
+
) {
|
|
309
|
+
throw new Error(
|
|
310
|
+
"Failed to remove plant from iteration: No data returned",
|
|
311
|
+
);
|
|
177
312
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
return response.data.updatePlantQtyInIteration;
|
|
313
|
+
return response.data.removePlantFromIteration;
|
|
314
|
+
}
|
|
315
|
+
async listIterationPlants(iterationId) {
|
|
316
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
317
|
+
query: print(ListIterationPlantsDocument),
|
|
318
|
+
variables: {
|
|
319
|
+
iterationId,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
if (!response.data?.listIterationPlants) {
|
|
323
|
+
throw new Error("Failed to list iteration plants: No data returned");
|
|
191
324
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
325
|
+
return response.data.listIterationPlants;
|
|
326
|
+
}
|
|
327
|
+
async rotateContainer(containerId, name, note, newPlants, merchantId) {
|
|
328
|
+
const response = await this.httpClient.request(
|
|
329
|
+
"/graphql-containers",
|
|
330
|
+
{
|
|
331
|
+
query: print(RotateContainerDocument),
|
|
332
|
+
variables: {
|
|
333
|
+
containerId,
|
|
334
|
+
name,
|
|
335
|
+
note,
|
|
336
|
+
newPlants,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
merchantId,
|
|
340
|
+
);
|
|
341
|
+
if (!response.data?.rotateContainer) {
|
|
342
|
+
throw new Error("Failed to rotate container: No data returned");
|
|
204
343
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
344
|
+
return response.data.rotateContainer;
|
|
345
|
+
}
|
|
346
|
+
async createSoilTest(input, merchantId) {
|
|
347
|
+
const response = await this.httpClient.request(
|
|
348
|
+
"/graphql-containers",
|
|
349
|
+
{
|
|
350
|
+
query: print(CreateSoilTestDocument),
|
|
351
|
+
variables: {
|
|
352
|
+
input: {
|
|
353
|
+
containerId: input.containerId,
|
|
354
|
+
iterationId: input.iterationId,
|
|
355
|
+
location: input.location,
|
|
356
|
+
testDate: input.testDate,
|
|
357
|
+
sampleDepth: input.sampleDepth,
|
|
358
|
+
soilTexture: input.soilTexture,
|
|
359
|
+
moistureLevel: input.moistureLevel,
|
|
360
|
+
pHLevel: input.pHLevel,
|
|
361
|
+
drainageRate: input.drainageRate,
|
|
362
|
+
organicMatterEstimate: input.organicMatterEstimate,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
merchantId,
|
|
367
|
+
);
|
|
368
|
+
if (!response.data?.createSoilTest) {
|
|
369
|
+
throw new Error("Failed to create soil test: No data returned");
|
|
216
370
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
371
|
+
return response.data.createSoilTest;
|
|
372
|
+
}
|
|
373
|
+
async listSoilTestsByContainer(containerId, merchantId) {
|
|
374
|
+
const response = await this.httpClient.request(
|
|
375
|
+
"/graphql-containers",
|
|
376
|
+
{
|
|
377
|
+
query: print(ListSoilTestsByContainerDocument),
|
|
378
|
+
variables: {
|
|
379
|
+
containerId,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
merchantId,
|
|
383
|
+
);
|
|
384
|
+
if (!response.data?.listSoilTestsByContainer) {
|
|
385
|
+
throw new Error(
|
|
386
|
+
"Failed to list soil tests by container: No data returned",
|
|
387
|
+
);
|
|
231
388
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
drainageRate: input.drainageRate,
|
|
246
|
-
organicMatterEstimate: input.organicMatterEstimate,
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
}, merchantId);
|
|
250
|
-
if (!response.data?.createSoilTest) {
|
|
251
|
-
throw new Error('Failed to create soil test: No data returned');
|
|
252
|
-
}
|
|
253
|
-
return response.data.createSoilTest;
|
|
389
|
+
return response.data.listSoilTestsByContainer;
|
|
390
|
+
}
|
|
391
|
+
async listSoilTestsByIteration(iterationId) {
|
|
392
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
393
|
+
query: print(ListSoilTestsByIterationDocument),
|
|
394
|
+
variables: {
|
|
395
|
+
iterationId,
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
if (!response.data?.listSoilTestsByIteration) {
|
|
399
|
+
throw new Error(
|
|
400
|
+
"Failed to list soil tests by iteration: No data returned",
|
|
401
|
+
);
|
|
254
402
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
403
|
+
return response.data.listSoilTestsByIteration;
|
|
404
|
+
}
|
|
405
|
+
async deleteSoilTest(id) {
|
|
406
|
+
const response = await this.httpClient.request("/graphql-containers", {
|
|
407
|
+
query: print(DeleteSoilTestDocument),
|
|
408
|
+
variables: {
|
|
409
|
+
id,
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
if (
|
|
413
|
+
response.data?.deleteSoilTest === undefined ||
|
|
414
|
+
response.data.deleteSoilTest === null
|
|
415
|
+
) {
|
|
416
|
+
throw new Error("Failed to delete soil test: No data returned");
|
|
266
417
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
418
|
+
return response.data.deleteSoilTest;
|
|
419
|
+
}
|
|
420
|
+
async createContainerLog(input, merchantId) {
|
|
421
|
+
const response = await this.httpClient.request(
|
|
422
|
+
"/graphql-containers",
|
|
423
|
+
{
|
|
424
|
+
query: print(CreateContainerLogDocument),
|
|
425
|
+
variables: {
|
|
426
|
+
input: {
|
|
427
|
+
containerId: input.containerId,
|
|
428
|
+
iterationId: input.iterationId,
|
|
429
|
+
note: input.note,
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
merchantId,
|
|
434
|
+
);
|
|
435
|
+
if (!response.data?.createContainerLog) {
|
|
436
|
+
throw new Error("Failed to create container log: No data returned");
|
|
278
437
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
|
|
438
|
+
return response.data.createContainerLog;
|
|
439
|
+
}
|
|
440
|
+
async getContainerLogs(containerId, merchantId) {
|
|
441
|
+
const response = await this.httpClient.request(
|
|
442
|
+
"/graphql-containers",
|
|
443
|
+
{
|
|
444
|
+
query: print(GetContainerLogsDocument),
|
|
445
|
+
variables: {
|
|
446
|
+
containerId,
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
merchantId,
|
|
450
|
+
);
|
|
451
|
+
if (!response.data?.getContainerLogs) {
|
|
452
|
+
throw new Error("Failed to get container logs: No data returned");
|
|
290
453
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
454
|
+
return response.data.getContainerLogs;
|
|
455
|
+
}
|
|
456
|
+
async updateContainerLog(id, note, merchantId) {
|
|
457
|
+
const response = await this.httpClient.request(
|
|
458
|
+
"/graphql-containers",
|
|
459
|
+
{
|
|
460
|
+
query: print(UpdateContainerLogDocument),
|
|
461
|
+
variables: {
|
|
462
|
+
id,
|
|
463
|
+
note,
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
merchantId,
|
|
467
|
+
);
|
|
468
|
+
if (!response.data?.updateContainerLog) {
|
|
469
|
+
throw new Error("Failed to update container log: No data returned");
|
|
306
470
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
471
|
+
return response.data.updateContainerLog;
|
|
472
|
+
}
|
|
473
|
+
async createTask(input, merchantId) {
|
|
474
|
+
const response = await this.httpClient.request(
|
|
475
|
+
"/graphql-containers",
|
|
476
|
+
{
|
|
477
|
+
query: print(CreateTaskDocument),
|
|
478
|
+
variables: {
|
|
479
|
+
input: {
|
|
480
|
+
containerId: input.containerId,
|
|
481
|
+
iterationId: input.iterationId,
|
|
482
|
+
name: input.name,
|
|
483
|
+
description: input.description,
|
|
484
|
+
status: input.status,
|
|
485
|
+
dueDate: input.dueDate,
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
merchantId,
|
|
490
|
+
);
|
|
491
|
+
if (!response.data?.createTask) {
|
|
492
|
+
throw new Error("Failed to create task: No data returned");
|
|
318
493
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
494
|
+
return response.data.createTask;
|
|
495
|
+
}
|
|
496
|
+
async updateTask(input, merchantId) {
|
|
497
|
+
const response = await this.httpClient.request(
|
|
498
|
+
"/graphql-containers",
|
|
499
|
+
{
|
|
500
|
+
query: print(UpdateTaskDocument),
|
|
501
|
+
variables: {
|
|
502
|
+
input: {
|
|
503
|
+
id: input.id,
|
|
504
|
+
...(input.name !== undefined ? { name: input.name } : {}),
|
|
505
|
+
...(input.description !== undefined
|
|
506
|
+
? { description: input.description }
|
|
507
|
+
: {}),
|
|
508
|
+
...(input.status !== undefined ? { status: input.status } : {}),
|
|
509
|
+
...(input.dueDate !== undefined ? { dueDate: input.dueDate } : {}),
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
merchantId,
|
|
514
|
+
);
|
|
515
|
+
if (!response.data?.updateTask) {
|
|
516
|
+
throw new Error("Failed to update task: No data returned");
|
|
331
517
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
518
|
+
return response.data.updateTask;
|
|
519
|
+
}
|
|
520
|
+
async deleteTask(id, merchantId) {
|
|
521
|
+
const response = await this.httpClient.request(
|
|
522
|
+
"/graphql-containers",
|
|
523
|
+
{
|
|
524
|
+
query: print(DeleteTaskDocument),
|
|
525
|
+
variables: {
|
|
526
|
+
id,
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
merchantId,
|
|
530
|
+
);
|
|
531
|
+
if (
|
|
532
|
+
response.data?.deleteTask === undefined ||
|
|
533
|
+
response.data.deleteTask === null
|
|
534
|
+
) {
|
|
535
|
+
throw new Error("Failed to delete task: No data returned");
|
|
350
536
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
return response.data.updateTask;
|
|
537
|
+
return response.data.deleteTask;
|
|
538
|
+
}
|
|
539
|
+
async listTasks(containerId, merchantId) {
|
|
540
|
+
const response = await this.httpClient.request(
|
|
541
|
+
"/graphql-containers",
|
|
542
|
+
{
|
|
543
|
+
query: print(ListTasksDocument),
|
|
544
|
+
variables: {
|
|
545
|
+
containerId,
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
merchantId,
|
|
549
|
+
);
|
|
550
|
+
if (!response.data?.listTasks) {
|
|
551
|
+
throw new Error("Failed to list tasks: No data returned");
|
|
368
552
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const response = await this.httpClient.request('/graphql-containers', {
|
|
383
|
-
query: print(ListTasksDocument),
|
|
384
|
-
variables: {
|
|
385
|
-
containerId,
|
|
386
|
-
},
|
|
387
|
-
}, merchantId);
|
|
388
|
-
if (!response.data?.listTasks) {
|
|
389
|
-
throw new Error('Failed to list tasks: No data returned');
|
|
390
|
-
}
|
|
391
|
-
return response.data.listTasks;
|
|
392
|
-
}
|
|
393
|
-
async listAllUserTasks(merchantId) {
|
|
394
|
-
const response = await this.httpClient.request('/graphql-containers', {
|
|
395
|
-
query: print(ListAllUserTasksDocument),
|
|
396
|
-
variables: {},
|
|
397
|
-
}, merchantId);
|
|
398
|
-
if (!response.data?.listAllUserTasks) {
|
|
399
|
-
throw new Error('Failed to list all user tasks: No data returned');
|
|
400
|
-
}
|
|
401
|
-
return response.data.listAllUserTasks;
|
|
553
|
+
return response.data.listTasks;
|
|
554
|
+
}
|
|
555
|
+
async listAllUserTasks(merchantId) {
|
|
556
|
+
const response = await this.httpClient.request(
|
|
557
|
+
"/graphql-containers",
|
|
558
|
+
{
|
|
559
|
+
query: print(ListAllUserTasksDocument),
|
|
560
|
+
variables: {},
|
|
561
|
+
},
|
|
562
|
+
merchantId,
|
|
563
|
+
);
|
|
564
|
+
if (!response.data?.listAllUserTasks) {
|
|
565
|
+
throw new Error("Failed to list all user tasks: No data returned");
|
|
402
566
|
}
|
|
567
|
+
return response.data.listAllUserTasks;
|
|
568
|
+
}
|
|
403
569
|
}
|
|
404
|
-
//# sourceMappingURL=ContainersClient.js.map
|
|
570
|
+
//# sourceMappingURL=ContainersClient.js.map
|