@zauru-sdk/graphql 6.10.0 → 6.11.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/dist/GraphQL.queries.d.ts +13 -0
- package/dist/esm/GraphQL.queries.js +55 -4
- package/package.json +2 -2
|
@@ -100,6 +100,18 @@ export type GetWebAppRowsByTableIdOptions = {
|
|
|
100
100
|
lte?: string;
|
|
101
101
|
lt?: string;
|
|
102
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Cursor for `order_by: { id: desc }`. Next page: `id: { _lt: lastSeenId }`.
|
|
105
|
+
*/
|
|
106
|
+
idLt?: number;
|
|
107
|
+
};
|
|
108
|
+
export type GetInvoicesOptions = {
|
|
109
|
+
payeeIds?: number[];
|
|
110
|
+
voided?: boolean;
|
|
111
|
+
paid?: boolean;
|
|
112
|
+
issued?: boolean;
|
|
113
|
+
lastId?: number;
|
|
114
|
+
limit?: number;
|
|
103
115
|
};
|
|
104
116
|
export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number, options?: GetWebAppRowsByTableIdOptions) => string;
|
|
105
117
|
export declare const getPayeeCategoryByIdStringQuery: (id: number) => string;
|
|
@@ -171,6 +183,7 @@ export declare const getPaymentMethodsStringQuery: (config: {
|
|
|
171
183
|
onlyActives: boolean;
|
|
172
184
|
}) => string;
|
|
173
185
|
export declare const getPaymentTermByIdStringQuery: (id: number) => string;
|
|
186
|
+
export declare const getInvoicesStringQuery: (options?: GetInvoicesOptions) => string;
|
|
174
187
|
export declare const getInvoicesByAgencyIdStringQuery: (id: number, filters: {
|
|
175
188
|
tag_id?: string;
|
|
176
189
|
invoice_id?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getProductionWorkOrderStringQuery = void 0;
|
|
3
|
+
exports.getCasesStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getInvoicesStringQuery = 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.getBookingByPurchaseOrderAndReferenceStringQuery = exports.getShipmentsStringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
|
|
4
|
+
exports.getProductionWorkOrderStringQuery = exports.getPrintTemplatesStringQuery = void 0;
|
|
5
5
|
const getLast100ReceptionsStringQuery = (agency_id) => {
|
|
6
6
|
const conditions = ["voided: {_eq: false}"];
|
|
7
7
|
if (agency_id) {
|
|
@@ -587,7 +587,6 @@ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) =>
|
|
|
587
587
|
${whereClause}
|
|
588
588
|
) {
|
|
589
589
|
id
|
|
590
|
-
lock_version
|
|
591
590
|
zid
|
|
592
591
|
created_at
|
|
593
592
|
due
|
|
@@ -771,13 +770,23 @@ const buildCreatedAtClause = (createdAt) => {
|
|
|
771
770
|
}
|
|
772
771
|
return bounds.length ? `created_at: { ${bounds.join(", ")} }` : "";
|
|
773
772
|
};
|
|
773
|
+
const requirePositiveInt = (value, label) => {
|
|
774
|
+
const n = Number(value);
|
|
775
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
776
|
+
throw new Error(`Invalid ${label}`);
|
|
777
|
+
}
|
|
778
|
+
return n;
|
|
779
|
+
};
|
|
774
780
|
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id, options) => {
|
|
775
|
-
const { limit, data, createdAt } = options ?? {};
|
|
781
|
+
const { limit, data, createdAt, idLt } = options ?? {};
|
|
776
782
|
const tableId = Number(webapp_table_id);
|
|
777
783
|
const conditions = [];
|
|
778
784
|
if (tableId) {
|
|
779
785
|
conditions.push(`webapp_table_id: {_eq: ${tableId}}`);
|
|
780
786
|
}
|
|
787
|
+
if (idLt != null) {
|
|
788
|
+
conditions.push(`id: {_lt: ${requirePositiveInt(idLt, "idLt")}}`);
|
|
789
|
+
}
|
|
781
790
|
const createdAtClause = buildCreatedAtClause(createdAt);
|
|
782
791
|
if (createdAtClause) {
|
|
783
792
|
conditions.push(createdAtClause);
|
|
@@ -1756,6 +1765,48 @@ query getPaymentTermById {
|
|
|
1756
1765
|
}
|
|
1757
1766
|
`;
|
|
1758
1767
|
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1768
|
+
const getInvoicesStringQuery = (options) => {
|
|
1769
|
+
const conditions = [];
|
|
1770
|
+
const rawLimit = options?.limit != null ? Number(options.limit) : 500;
|
|
1771
|
+
const limit = Number.isInteger(rawLimit) && rawLimit > 0 ? rawLimit : 500;
|
|
1772
|
+
if (options?.payeeIds?.length) {
|
|
1773
|
+
const ids = options.payeeIds.map((id) => requirePositiveInt(id, "payee id"));
|
|
1774
|
+
conditions.push(`payee_id: { _in: [${ids.join(", ")}] }`);
|
|
1775
|
+
}
|
|
1776
|
+
if (options?.voided !== undefined) {
|
|
1777
|
+
conditions.push(`voided: { _eq: ${Boolean(options.voided)} }`);
|
|
1778
|
+
}
|
|
1779
|
+
if (options?.paid !== undefined) {
|
|
1780
|
+
conditions.push(`paid: { _eq: ${Boolean(options.paid)} }`);
|
|
1781
|
+
}
|
|
1782
|
+
if (options?.issued !== undefined) {
|
|
1783
|
+
conditions.push(`issued: { _eq: ${Boolean(options.issued)} }`);
|
|
1784
|
+
}
|
|
1785
|
+
if (options?.lastId != null) {
|
|
1786
|
+
const lastId = Number(options.lastId);
|
|
1787
|
+
if (!Number.isInteger(lastId) || lastId < 0) {
|
|
1788
|
+
throw new Error("Invalid lastId");
|
|
1789
|
+
}
|
|
1790
|
+
conditions.push(`id: { _gt: ${lastId} }`);
|
|
1791
|
+
}
|
|
1792
|
+
const whereClause = conditions.length
|
|
1793
|
+
? `where: { ${conditions.join(", ")} }`
|
|
1794
|
+
: "";
|
|
1795
|
+
return `
|
|
1796
|
+
query getInvoices {
|
|
1797
|
+
invoices(
|
|
1798
|
+
${[whereClause, "order_by: { id: asc }", `limit: ${limit}`]
|
|
1799
|
+
.filter(Boolean)
|
|
1800
|
+
.join(", ")}
|
|
1801
|
+
) {
|
|
1802
|
+
id
|
|
1803
|
+
payee_id
|
|
1804
|
+
due
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
`;
|
|
1808
|
+
};
|
|
1809
|
+
exports.getInvoicesStringQuery = getInvoicesStringQuery;
|
|
1759
1810
|
const getInvoicesByAgencyIdStringQuery = (id, filters) => `
|
|
1760
1811
|
query getInvoicesByAgencyId {
|
|
1761
1812
|
invoices(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/graphql",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.0",
|
|
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",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"tsx": "^4.23.15",
|
|
24
24
|
"typescript": "^5.1.6"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "9acaa9221f755ad34df00b631f59bf8b569712ba"
|
|
27
27
|
}
|