@zauru-sdk/graphql 2.19.1 → 2.25.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/GraphQL.queries.d.ts +1 -1
- package/dist/esm/GraphQL.queries.js +95 -61
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getLast100ReceptionsStringQuery: (agency_id
|
|
1
|
+
export declare const getLast100ReceptionsStringQuery: (agency_id?: number | string) => string;
|
|
2
2
|
export declare const getPurchaseOrderByIdNumberStringQuery: (id_number: string) => string;
|
|
3
3
|
export declare const getPurchaseOrderStringQuery: (id: number, config?: {
|
|
4
4
|
withLotStocks: boolean;
|
|
@@ -1,38 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPrintTemplatesStringQuery = exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getCaseFormSubmissionsByCaseIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = exports.getEmployeesStringQuery = exports.getEmployeeProfileStringQuery = exports.getConsolidatesBetweenDatesStringQuery = exports.getItemsBySuperCategoryStringQuery = exports.getItemsStringQuery = exports.getItemsByCategoryStringQuery = exports.getItemCategoryByIdStringQuery = exports.getSuperCategoryByIdStringQuery = exports.getPayeeByIdStringQuery = exports.getClientCategoriesStringQuery = exports.getProviderCategoriesStringQuery = exports.getPayeeCategoriesStringQuery = exports.getPayeeCategoriesByNotesMatchStringQuery = exports.getPayeeCategoryByIdStringQuery = exports.getWebAppRowsByWebAppTableIdStringQuery = exports.getWebAppRowStringQuery = exports.getAgenciesStringQuery = exports.getProvidersStringQuery = exports.getPayeesStringQuery = exports.getPurchaseOrdersBetweenDatesStringQuery = exports.getSerialsStringQuery = exports.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
|
|
4
|
-
const getLast100ReceptionsStringQuery = (agency_id) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
created_at
|
|
9
|
-
due
|
|
10
|
-
id_number
|
|
11
|
-
memo
|
|
12
|
-
payee_id
|
|
13
|
-
issue_date
|
|
14
|
-
discount
|
|
15
|
-
other_charges
|
|
16
|
-
authorized
|
|
17
|
-
received
|
|
18
|
-
transport_type
|
|
19
|
-
shipment_reference
|
|
20
|
-
purchase_order_details {
|
|
21
|
-
item_id
|
|
22
|
-
id
|
|
23
|
-
reference
|
|
24
|
-
booked_quantity
|
|
25
|
-
delivered_quantity
|
|
4
|
+
const getLast100ReceptionsStringQuery = (agency_id) => {
|
|
5
|
+
const conditions = ["voided: {_eq: false}"];
|
|
6
|
+
if (agency_id) {
|
|
7
|
+
conditions.push(`agency_id: {_eq: ${agency_id}}`);
|
|
26
8
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
9
|
+
return `
|
|
10
|
+
query getLast100Receptions {
|
|
11
|
+
purchase_orders(
|
|
12
|
+
limit: 100,
|
|
13
|
+
order_by: {
|
|
14
|
+
created_at: desc
|
|
15
|
+
},
|
|
16
|
+
where: {
|
|
17
|
+
${conditions.join(", ")}
|
|
18
|
+
}
|
|
19
|
+
) {
|
|
20
|
+
id
|
|
21
|
+
created_at
|
|
22
|
+
due
|
|
23
|
+
id_number
|
|
24
|
+
memo
|
|
25
|
+
payee_id
|
|
26
|
+
issue_date
|
|
27
|
+
discount
|
|
28
|
+
other_charges
|
|
29
|
+
authorized
|
|
30
|
+
received
|
|
31
|
+
transport_type
|
|
32
|
+
shipment_reference
|
|
33
|
+
reference
|
|
34
|
+
purchase_order_details {
|
|
35
|
+
item_id
|
|
36
|
+
id
|
|
37
|
+
reference
|
|
38
|
+
booked_quantity
|
|
39
|
+
delivered_quantity
|
|
40
|
+
}
|
|
41
|
+
lots(where: {active: {_eq: true}}) {
|
|
42
|
+
id
|
|
43
|
+
name
|
|
44
|
+
description
|
|
45
|
+
item_id
|
|
46
|
+
}
|
|
47
|
+
}
|
|
32
48
|
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
36
51
|
exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
|
|
37
52
|
const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
|
|
38
53
|
query getPurchaseOrderByIdNumber {
|
|
@@ -186,23 +201,24 @@ query getPurchaseOrder($id: bigint) @cached {
|
|
|
186
201
|
exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
|
|
187
202
|
const getShipmentsStringQuery = ({ agency_to_id, agency_from_id, suffix, voided, delivered, shipped, returned, id_number_not_null = false, id_number, id_number_not_empty = false, withMovementLots = false, withPurchaseOrdersByShipmentReference = false, limit = 1000, id, wheres, memoILike, plannedShippingDateRange, plannedDeliveryDateRange, }) => {
|
|
188
203
|
let conditions = [];
|
|
189
|
-
if (suffix) {
|
|
190
|
-
conditions.push(`id_number: {_ilike: "%${suffix}%"}`);
|
|
191
|
-
}
|
|
192
204
|
if (agency_to_id) {
|
|
193
205
|
conditions.push(`agency_to_id: {_eq: ${agency_to_id}}`);
|
|
194
206
|
}
|
|
195
207
|
if (agency_from_id) {
|
|
196
208
|
conditions.push(`agency_from_id: {_eq: ${agency_from_id}}`);
|
|
197
209
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (
|
|
205
|
-
|
|
210
|
+
// Merge all id_number conditions into a single object to avoid duplicate keys
|
|
211
|
+
const idNumberConditions = [];
|
|
212
|
+
if (suffix)
|
|
213
|
+
idNumberConditions.push(`_ilike: "%${suffix}%"`);
|
|
214
|
+
if (id_number)
|
|
215
|
+
idNumberConditions.push(`_eq: "${id_number}"`);
|
|
216
|
+
if (id_number_not_empty)
|
|
217
|
+
idNumberConditions.push(`_neq: ""`);
|
|
218
|
+
if (id_number_not_null)
|
|
219
|
+
idNumberConditions.push(`_is_null: false`);
|
|
220
|
+
if (idNumberConditions.length > 0) {
|
|
221
|
+
conditions.push(`id_number: { ${idNumberConditions.join(", ")} }`);
|
|
206
222
|
}
|
|
207
223
|
if (id) {
|
|
208
224
|
conditions.push(`id: {_eq: ${id}}`);
|
|
@@ -383,7 +399,8 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
|
|
|
383
399
|
if (config.agencyNameIlike) {
|
|
384
400
|
conditions.push(`agency: { name: { _ilike: "%${config.agencyNameIlike}%" } }`);
|
|
385
401
|
}
|
|
386
|
-
|
|
402
|
+
// Merge all payee conditions to avoid duplicate keys
|
|
403
|
+
{
|
|
387
404
|
const payeeConditions = [];
|
|
388
405
|
if (config.payeeId) {
|
|
389
406
|
if (config.payeeId.toString().includes(",")) {
|
|
@@ -393,19 +410,40 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
|
|
|
393
410
|
payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
|
|
394
411
|
}
|
|
395
412
|
}
|
|
413
|
+
const payeeCategoryIdConditions = [];
|
|
396
414
|
if (config.payeeCategoryId) {
|
|
397
|
-
|
|
415
|
+
payeeCategoryIdConditions.push(`_eq: ${config.payeeCategoryId}`);
|
|
416
|
+
}
|
|
417
|
+
if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
|
|
418
|
+
payeeCategoryIdConditions.push(`_in: [${config.payeeCategoryIds.join(",")}]`);
|
|
419
|
+
}
|
|
420
|
+
if (config.excludePayeeCategoryIds &&
|
|
421
|
+
config.excludePayeeCategoryIds.length > 0) {
|
|
422
|
+
payeeCategoryIdConditions.push(`_nin: [${config.excludePayeeCategoryIds.join(",")}]`);
|
|
423
|
+
}
|
|
424
|
+
if (payeeCategoryIdConditions.length > 0) {
|
|
425
|
+
payeeConditions.push(`payee_category: { id: { ${payeeCategoryIdConditions.join(", ")} } }`);
|
|
426
|
+
}
|
|
427
|
+
if (payeeConditions.length > 0) {
|
|
428
|
+
conditions.push(`payee: { ${payeeConditions.join(", ")} }`);
|
|
398
429
|
}
|
|
399
|
-
conditions.push(`payee: { ${payeeConditions.join(", ")} }`);
|
|
400
430
|
}
|
|
431
|
+
// Merge all purchase_order_details conditions to avoid duplicate keys
|
|
432
|
+
const purchaseOrderDetailsConditions = [];
|
|
401
433
|
if (config.itemId) {
|
|
402
434
|
if (config.itemId.toString().includes(",")) {
|
|
403
|
-
|
|
435
|
+
purchaseOrderDetailsConditions.push(`item_id: { _in: [${config.itemId}] }`);
|
|
404
436
|
}
|
|
405
437
|
else {
|
|
406
|
-
|
|
438
|
+
purchaseOrderDetailsConditions.push(`item_id: { _eq: ${config.itemId} }`);
|
|
407
439
|
}
|
|
408
440
|
}
|
|
441
|
+
if (config.poDetailTagId) {
|
|
442
|
+
purchaseOrderDetailsConditions.push(`tag_id: { _eq: ${config.poDetailTagId} }`);
|
|
443
|
+
}
|
|
444
|
+
if (purchaseOrderDetailsConditions.length > 0) {
|
|
445
|
+
conditions.push(`purchase_order_details: { ${purchaseOrderDetailsConditions.join(", ")} }`);
|
|
446
|
+
}
|
|
409
447
|
if (config.reference) {
|
|
410
448
|
if (config.reference.toString().includes(",")) {
|
|
411
449
|
conditions.push(`reference: { _in: [${config.reference}] }`);
|
|
@@ -417,21 +455,11 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
|
|
|
417
455
|
if (config.lotItemIdExclusion) {
|
|
418
456
|
conditions.push(`lots: { item_id: { _neq: ${config.lotItemIdExclusion} } }`);
|
|
419
457
|
}
|
|
420
|
-
if (config.poDetailTagId) {
|
|
421
|
-
conditions.push(`purchase_order_details: { tag_id: { _eq: ${config.poDetailTagId} } }`);
|
|
422
|
-
}
|
|
423
458
|
if (!config.id_number && !config.ids?.length) {
|
|
424
459
|
conditions.push(config.betweenIssueDate
|
|
425
460
|
? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
|
|
426
461
|
: `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
|
|
427
462
|
}
|
|
428
|
-
if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
|
|
429
|
-
conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
|
|
430
|
-
}
|
|
431
|
-
if (config.excludePayeeCategoryIds &&
|
|
432
|
-
config.excludePayeeCategoryIds.length > 0) {
|
|
433
|
-
conditions.push(`payee: { payee_category: { id: { _nin: [${config.excludePayeeCategoryIds.join(",")}] } } }`);
|
|
434
|
-
}
|
|
435
463
|
if (!!config.discountComparisonOperator && !!config.discount) {
|
|
436
464
|
conditions.push(`discount: { ${config.discountComparisonOperator}: ${config.discount} }`);
|
|
437
465
|
}
|
|
@@ -1203,11 +1231,17 @@ query getInvoiceFormSubmissionsByAgencyId {
|
|
|
1203
1231
|
id_number: { _ilike: "%${filters?.payee_id_number_search}%"}
|
|
1204
1232
|
},`
|
|
1205
1233
|
: ""}
|
|
1206
|
-
${filters?.item_ids?.length
|
|
1207
|
-
? `invoice_details: {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1234
|
+
${filters?.item_ids?.length || filters?.bundle_ids?.length
|
|
1235
|
+
? `invoice_details: {${[
|
|
1236
|
+
filters?.item_ids?.length
|
|
1237
|
+
? `item_id: {_in: [${filters?.item_ids?.join(",")}]}`
|
|
1238
|
+
: "",
|
|
1239
|
+
filters?.bundle_ids?.length
|
|
1240
|
+
? `bundle_id: {_in: [${filters?.bundle_ids?.join(",")}]}`
|
|
1241
|
+
: "",
|
|
1242
|
+
]
|
|
1243
|
+
.filter(Boolean)
|
|
1244
|
+
.join(", ")}}`
|
|
1211
1245
|
: ""}
|
|
1212
1246
|
voided: {_eq: false}
|
|
1213
1247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/graphql",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "Queries de uso común para las aplicación de Zauru.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"typescript": "^5.1.6"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "2cb51ed168e3e4df68625aecd1be63ff987977b3"
|
|
25
25
|
}
|