@zauru-sdk/graphql 1.0.77 → 1.0.78
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/GraphQL.queries.d.ts +1 -0
- package/dist/cjs/GraphQL.queries.js +95 -85
- package/dist/esm/GraphQL.queries.js +95 -85
- package/package.json +2 -2
|
@@ -10,6 +10,7 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config?: {
|
|
|
10
10
|
agencyId?: number | string;
|
|
11
11
|
itemId?: number | string;
|
|
12
12
|
payeeCategoryId?: number | string;
|
|
13
|
+
payeeId?: number | string;
|
|
13
14
|
consolidateIdFilter?: boolean;
|
|
14
15
|
lotItemIdExclusion?: number;
|
|
15
16
|
poDetailTagId?: number;
|
|
@@ -208,99 +208,109 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
|
|
|
208
208
|
consolidateIdFilter: false,
|
|
209
209
|
withLotStocks: false,
|
|
210
210
|
betweenIssueDate: false,
|
|
211
|
-
}) =>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
$startDate: ${config?.betweenIssueDate ? "date" : "timestamp"},
|
|
216
|
-
$endDate: ${config?.betweenIssueDate ? "date" : "timestamp"}
|
|
217
|
-
)`} {
|
|
218
|
-
purchase_orders (
|
|
219
|
-
order_by: {id: desc},
|
|
220
|
-
where: {
|
|
221
|
-
${config.agencyId
|
|
222
|
-
? `agency_id: {
|
|
223
|
-
_eq: ${config.agencyId}
|
|
224
|
-
},`
|
|
225
|
-
: ""}
|
|
226
|
-
${config.payeeCategoryId
|
|
227
|
-
? `payee: {
|
|
228
|
-
payee_category: {
|
|
229
|
-
id: {
|
|
230
|
-
_eq: ${config.payeeCategoryId}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},`
|
|
234
|
-
: ""}
|
|
235
|
-
${config.itemId
|
|
236
|
-
? `purchase_order_details: {
|
|
237
|
-
item_id: {_eq: ${config.itemId}}
|
|
238
|
-
},`
|
|
239
|
-
: ""}
|
|
240
|
-
${config.lotItemIdExclusion
|
|
241
|
-
? `lots: {item_id: {_neq: ${config.lotItemIdExclusion}}},`
|
|
242
|
-
: ""}
|
|
243
|
-
${config.poDetailTagId
|
|
244
|
-
? `purchase_order_details: {tag_id: {_eq: ${config.poDetailTagId}}},`
|
|
245
|
-
: ""}
|
|
246
|
-
${config.consolidateIdFilter ? "consolidate_id: {_is_null: true}," : ""}
|
|
247
|
-
${config.id_number ? `id_number: {_ilike: "%${config.id_number}%"}` : ""}
|
|
248
|
-
${config.id_number
|
|
249
|
-
? ""
|
|
250
|
-
: config.betweenIssueDate
|
|
251
|
-
? "issue_date: {_gte: $startDate, _lte: $endDate}"
|
|
252
|
-
: "created_at: {_gte: $startDate, _lte: $endDate}"}
|
|
211
|
+
}) => {
|
|
212
|
+
const conditions = [];
|
|
213
|
+
if (config.agencyId) {
|
|
214
|
+
conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
|
|
253
215
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
created_at
|
|
257
|
-
due
|
|
258
|
-
id_number
|
|
259
|
-
memo
|
|
260
|
-
payee_id
|
|
261
|
-
issue_date
|
|
262
|
-
agency_id
|
|
263
|
-
discount
|
|
264
|
-
other_charges
|
|
265
|
-
consolidate_id
|
|
266
|
-
purchase_order_details {
|
|
267
|
-
item_id
|
|
268
|
-
id
|
|
269
|
-
reference
|
|
270
|
-
booked_quantity
|
|
271
|
-
delivered_quantity
|
|
216
|
+
if (config.consolidateIdFilter) {
|
|
217
|
+
conditions.push("consolidate_id: { _is_null: true }");
|
|
272
218
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
name
|
|
276
|
-
description
|
|
277
|
-
${config.withLotStocks
|
|
278
|
-
? `lot_stocks {
|
|
279
|
-
id
|
|
280
|
-
available
|
|
281
|
-
incoming
|
|
282
|
-
outgoing
|
|
283
|
-
agency_id
|
|
284
|
-
}`
|
|
285
|
-
: ""}
|
|
219
|
+
if (config.id_number) {
|
|
220
|
+
conditions.push(`id_number: { _ilike: "%${config.id_number}%" }`);
|
|
286
221
|
}
|
|
287
|
-
|
|
288
|
-
|
|
222
|
+
if (config.payeeId || config.payeeCategoryId) {
|
|
223
|
+
const payeeConditions = [];
|
|
224
|
+
if (config.payeeId) {
|
|
225
|
+
payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
|
|
226
|
+
}
|
|
227
|
+
if (config.payeeCategoryId) {
|
|
228
|
+
payeeConditions.push(`payee_category: { id: { _eq: ${config.payeeCategoryId} } }`);
|
|
229
|
+
}
|
|
230
|
+
conditions.push(`payee: { ${payeeConditions.join(", ")} }`);
|
|
231
|
+
}
|
|
232
|
+
if (config.itemId) {
|
|
233
|
+
conditions.push(`purchase_order_details: { item_id: { _eq: ${config.itemId} } }`);
|
|
234
|
+
}
|
|
235
|
+
if (config.lotItemIdExclusion) {
|
|
236
|
+
conditions.push(`lots: { item_id: { _neq: ${config.lotItemIdExclusion} } }`);
|
|
237
|
+
}
|
|
238
|
+
if (config.poDetailTagId) {
|
|
239
|
+
conditions.push(`purchase_order_details: { tag_id: { _eq: ${config.poDetailTagId} } }`);
|
|
240
|
+
}
|
|
241
|
+
if (!config.id_number) {
|
|
242
|
+
conditions.push(config.betweenIssueDate
|
|
243
|
+
? "issue_date: { _gte: $startDate, _lte: $endDate }"
|
|
244
|
+
: "created_at: { _gte: $startDate, _lte: $endDate }");
|
|
245
|
+
}
|
|
246
|
+
const whereClause = conditions.length
|
|
247
|
+
? `where: { ${conditions.join(", ")} }`
|
|
248
|
+
: "";
|
|
249
|
+
const dateVariables = config.id_number
|
|
250
|
+
? ""
|
|
251
|
+
: `(
|
|
252
|
+
$startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
|
|
253
|
+
$endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
|
|
254
|
+
)`;
|
|
255
|
+
const lotStocksFragment = config.withLotStocks
|
|
256
|
+
? `
|
|
257
|
+
lot_stocks {
|
|
289
258
|
id
|
|
290
|
-
|
|
259
|
+
available
|
|
260
|
+
incoming
|
|
261
|
+
outgoing
|
|
262
|
+
agency_id
|
|
263
|
+
}
|
|
264
|
+
`
|
|
265
|
+
: "";
|
|
266
|
+
return `
|
|
267
|
+
query getPurchaseOrdersBetweenDates ${dateVariables} {
|
|
268
|
+
purchase_orders (
|
|
269
|
+
order_by: { id: desc },
|
|
270
|
+
${whereClause}
|
|
271
|
+
) {
|
|
272
|
+
id
|
|
273
|
+
created_at
|
|
274
|
+
due
|
|
291
275
|
id_number
|
|
292
|
-
|
|
293
|
-
needs_transport
|
|
276
|
+
memo
|
|
294
277
|
payee_id
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
278
|
+
issue_date
|
|
279
|
+
agency_id
|
|
280
|
+
discount
|
|
281
|
+
other_charges
|
|
282
|
+
consolidate_id
|
|
283
|
+
purchase_order_details {
|
|
284
|
+
item_id
|
|
285
|
+
id
|
|
286
|
+
reference
|
|
287
|
+
booked_quantity
|
|
288
|
+
delivered_quantity
|
|
289
|
+
}
|
|
290
|
+
lots(where: { active: { _eq: true } }) {
|
|
291
|
+
id
|
|
292
|
+
name
|
|
293
|
+
description
|
|
294
|
+
${lotStocksFragment}
|
|
295
|
+
}
|
|
296
|
+
shipment_purchase_orders {
|
|
297
|
+
shipment {
|
|
298
|
+
id
|
|
299
|
+
zid
|
|
300
|
+
id_number
|
|
301
|
+
reference
|
|
302
|
+
needs_transport
|
|
303
|
+
payee_id
|
|
304
|
+
income
|
|
305
|
+
booker_id
|
|
306
|
+
agency_from_id
|
|
307
|
+
agency_to_id
|
|
308
|
+
}
|
|
309
|
+
}
|
|
299
310
|
}
|
|
300
311
|
}
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
`;
|
|
312
|
+
`;
|
|
313
|
+
};
|
|
304
314
|
exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
|
|
305
315
|
exports.getPayeesStringQuery = `
|
|
306
316
|
query getPayees {
|
|
@@ -208,99 +208,109 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config = {
|
|
|
208
208
|
consolidateIdFilter: false,
|
|
209
209
|
withLotStocks: false,
|
|
210
210
|
betweenIssueDate: false,
|
|
211
|
-
}) =>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
$startDate: ${config?.betweenIssueDate ? "date" : "timestamp"},
|
|
216
|
-
$endDate: ${config?.betweenIssueDate ? "date" : "timestamp"}
|
|
217
|
-
)`} {
|
|
218
|
-
purchase_orders (
|
|
219
|
-
order_by: {id: desc},
|
|
220
|
-
where: {
|
|
221
|
-
${config.agencyId
|
|
222
|
-
? `agency_id: {
|
|
223
|
-
_eq: ${config.agencyId}
|
|
224
|
-
},`
|
|
225
|
-
: ""}
|
|
226
|
-
${config.payeeCategoryId
|
|
227
|
-
? `payee: {
|
|
228
|
-
payee_category: {
|
|
229
|
-
id: {
|
|
230
|
-
_eq: ${config.payeeCategoryId}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},`
|
|
234
|
-
: ""}
|
|
235
|
-
${config.itemId
|
|
236
|
-
? `purchase_order_details: {
|
|
237
|
-
item_id: {_eq: ${config.itemId}}
|
|
238
|
-
},`
|
|
239
|
-
: ""}
|
|
240
|
-
${config.lotItemIdExclusion
|
|
241
|
-
? `lots: {item_id: {_neq: ${config.lotItemIdExclusion}}},`
|
|
242
|
-
: ""}
|
|
243
|
-
${config.poDetailTagId
|
|
244
|
-
? `purchase_order_details: {tag_id: {_eq: ${config.poDetailTagId}}},`
|
|
245
|
-
: ""}
|
|
246
|
-
${config.consolidateIdFilter ? "consolidate_id: {_is_null: true}," : ""}
|
|
247
|
-
${config.id_number ? `id_number: {_ilike: "%${config.id_number}%"}` : ""}
|
|
248
|
-
${config.id_number
|
|
249
|
-
? ""
|
|
250
|
-
: config.betweenIssueDate
|
|
251
|
-
? "issue_date: {_gte: $startDate, _lte: $endDate}"
|
|
252
|
-
: "created_at: {_gte: $startDate, _lte: $endDate}"}
|
|
211
|
+
}) => {
|
|
212
|
+
const conditions = [];
|
|
213
|
+
if (config.agencyId) {
|
|
214
|
+
conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
|
|
253
215
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
created_at
|
|
257
|
-
due
|
|
258
|
-
id_number
|
|
259
|
-
memo
|
|
260
|
-
payee_id
|
|
261
|
-
issue_date
|
|
262
|
-
agency_id
|
|
263
|
-
discount
|
|
264
|
-
other_charges
|
|
265
|
-
consolidate_id
|
|
266
|
-
purchase_order_details {
|
|
267
|
-
item_id
|
|
268
|
-
id
|
|
269
|
-
reference
|
|
270
|
-
booked_quantity
|
|
271
|
-
delivered_quantity
|
|
216
|
+
if (config.consolidateIdFilter) {
|
|
217
|
+
conditions.push("consolidate_id: { _is_null: true }");
|
|
272
218
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
name
|
|
276
|
-
description
|
|
277
|
-
${config.withLotStocks
|
|
278
|
-
? `lot_stocks {
|
|
279
|
-
id
|
|
280
|
-
available
|
|
281
|
-
incoming
|
|
282
|
-
outgoing
|
|
283
|
-
agency_id
|
|
284
|
-
}`
|
|
285
|
-
: ""}
|
|
219
|
+
if (config.id_number) {
|
|
220
|
+
conditions.push(`id_number: { _ilike: "%${config.id_number}%" }`);
|
|
286
221
|
}
|
|
287
|
-
|
|
288
|
-
|
|
222
|
+
if (config.payeeId || config.payeeCategoryId) {
|
|
223
|
+
const payeeConditions = [];
|
|
224
|
+
if (config.payeeId) {
|
|
225
|
+
payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
|
|
226
|
+
}
|
|
227
|
+
if (config.payeeCategoryId) {
|
|
228
|
+
payeeConditions.push(`payee_category: { id: { _eq: ${config.payeeCategoryId} } }`);
|
|
229
|
+
}
|
|
230
|
+
conditions.push(`payee: { ${payeeConditions.join(", ")} }`);
|
|
231
|
+
}
|
|
232
|
+
if (config.itemId) {
|
|
233
|
+
conditions.push(`purchase_order_details: { item_id: { _eq: ${config.itemId} } }`);
|
|
234
|
+
}
|
|
235
|
+
if (config.lotItemIdExclusion) {
|
|
236
|
+
conditions.push(`lots: { item_id: { _neq: ${config.lotItemIdExclusion} } }`);
|
|
237
|
+
}
|
|
238
|
+
if (config.poDetailTagId) {
|
|
239
|
+
conditions.push(`purchase_order_details: { tag_id: { _eq: ${config.poDetailTagId} } }`);
|
|
240
|
+
}
|
|
241
|
+
if (!config.id_number) {
|
|
242
|
+
conditions.push(config.betweenIssueDate
|
|
243
|
+
? "issue_date: { _gte: $startDate, _lte: $endDate }"
|
|
244
|
+
: "created_at: { _gte: $startDate, _lte: $endDate }");
|
|
245
|
+
}
|
|
246
|
+
const whereClause = conditions.length
|
|
247
|
+
? `where: { ${conditions.join(", ")} }`
|
|
248
|
+
: "";
|
|
249
|
+
const dateVariables = config.id_number
|
|
250
|
+
? ""
|
|
251
|
+
: `(
|
|
252
|
+
$startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
|
|
253
|
+
$endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
|
|
254
|
+
)`;
|
|
255
|
+
const lotStocksFragment = config.withLotStocks
|
|
256
|
+
? `
|
|
257
|
+
lot_stocks {
|
|
289
258
|
id
|
|
290
|
-
|
|
259
|
+
available
|
|
260
|
+
incoming
|
|
261
|
+
outgoing
|
|
262
|
+
agency_id
|
|
263
|
+
}
|
|
264
|
+
`
|
|
265
|
+
: "";
|
|
266
|
+
return `
|
|
267
|
+
query getPurchaseOrdersBetweenDates ${dateVariables} {
|
|
268
|
+
purchase_orders (
|
|
269
|
+
order_by: { id: desc },
|
|
270
|
+
${whereClause}
|
|
271
|
+
) {
|
|
272
|
+
id
|
|
273
|
+
created_at
|
|
274
|
+
due
|
|
291
275
|
id_number
|
|
292
|
-
|
|
293
|
-
needs_transport
|
|
276
|
+
memo
|
|
294
277
|
payee_id
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
278
|
+
issue_date
|
|
279
|
+
agency_id
|
|
280
|
+
discount
|
|
281
|
+
other_charges
|
|
282
|
+
consolidate_id
|
|
283
|
+
purchase_order_details {
|
|
284
|
+
item_id
|
|
285
|
+
id
|
|
286
|
+
reference
|
|
287
|
+
booked_quantity
|
|
288
|
+
delivered_quantity
|
|
289
|
+
}
|
|
290
|
+
lots(where: { active: { _eq: true } }) {
|
|
291
|
+
id
|
|
292
|
+
name
|
|
293
|
+
description
|
|
294
|
+
${lotStocksFragment}
|
|
295
|
+
}
|
|
296
|
+
shipment_purchase_orders {
|
|
297
|
+
shipment {
|
|
298
|
+
id
|
|
299
|
+
zid
|
|
300
|
+
id_number
|
|
301
|
+
reference
|
|
302
|
+
needs_transport
|
|
303
|
+
payee_id
|
|
304
|
+
income
|
|
305
|
+
booker_id
|
|
306
|
+
agency_from_id
|
|
307
|
+
agency_to_id
|
|
308
|
+
}
|
|
309
|
+
}
|
|
299
310
|
}
|
|
300
311
|
}
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
`;
|
|
312
|
+
`;
|
|
313
|
+
};
|
|
304
314
|
exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
|
|
305
315
|
exports.getPayeesStringQuery = `
|
|
306
316
|
query getPayees {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/graphql",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.78",
|
|
4
4
|
"description": "Queries de uso común para las aplicación de Zauru.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.1.6"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "1faea0e4c3468b24c7b740441af3fc5e9f552e3f"
|
|
26
26
|
}
|