@zauru-sdk/graphql 6.10.1 → 6.12.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 +14 -0
- package/dist/esm/GraphQL.queries.js +105 -3
- 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,8 @@ 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 getPaymentByIdStringQuery: (id: number) => string;
|
|
187
|
+
export declare const getInvoicesStringQuery: (options?: GetInvoicesOptions) => string;
|
|
174
188
|
export declare const getInvoicesByAgencyIdStringQuery: (id: number, filters: {
|
|
175
189
|
tag_id?: string;
|
|
176
190
|
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.getInvoicesByAgencyIdStringQuery = exports.getInvoicesStringQuery = exports.getPaymentByIdStringQuery = 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 = exports.getCasesStringQuery = void 0;
|
|
5
5
|
const getLast100ReceptionsStringQuery = (agency_id) => {
|
|
6
6
|
const conditions = ["voided: {_eq: false}"];
|
|
7
7
|
if (agency_id) {
|
|
@@ -770,13 +770,23 @@ const buildCreatedAtClause = (createdAt) => {
|
|
|
770
770
|
}
|
|
771
771
|
return bounds.length ? `created_at: { ${bounds.join(", ")} }` : "";
|
|
772
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
|
+
};
|
|
773
780
|
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id, options) => {
|
|
774
|
-
const { limit, data, createdAt } = options ?? {};
|
|
781
|
+
const { limit, data, createdAt, idLt } = options ?? {};
|
|
775
782
|
const tableId = Number(webapp_table_id);
|
|
776
783
|
const conditions = [];
|
|
777
784
|
if (tableId) {
|
|
778
785
|
conditions.push(`webapp_table_id: {_eq: ${tableId}}`);
|
|
779
786
|
}
|
|
787
|
+
if (idLt != null) {
|
|
788
|
+
conditions.push(`id: {_lt: ${requirePositiveInt(idLt, "idLt")}}`);
|
|
789
|
+
}
|
|
780
790
|
const createdAtClause = buildCreatedAtClause(createdAt);
|
|
781
791
|
if (createdAtClause) {
|
|
782
792
|
conditions.push(createdAtClause);
|
|
@@ -1755,6 +1765,98 @@ query getPaymentTermById {
|
|
|
1755
1765
|
}
|
|
1756
1766
|
`;
|
|
1757
1767
|
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1768
|
+
const getPaymentByIdStringQuery = (id) => {
|
|
1769
|
+
const paymentId = requirePositiveInt(id, "payment id");
|
|
1770
|
+
return `
|
|
1771
|
+
query getPaymentById {
|
|
1772
|
+
payments(where: { id: { _eq: ${paymentId} } }, limit: 1) {
|
|
1773
|
+
id
|
|
1774
|
+
zid
|
|
1775
|
+
id_number
|
|
1776
|
+
draft
|
|
1777
|
+
payee_id
|
|
1778
|
+
date
|
|
1779
|
+
agency_id
|
|
1780
|
+
payment_method_id
|
|
1781
|
+
reference
|
|
1782
|
+
charger_id
|
|
1783
|
+
receipt
|
|
1784
|
+
amount
|
|
1785
|
+
voided
|
|
1786
|
+
memo
|
|
1787
|
+
created_at
|
|
1788
|
+
updated_at
|
|
1789
|
+
creator_id
|
|
1790
|
+
entity_id
|
|
1791
|
+
payment_details_count
|
|
1792
|
+
confirmed_at
|
|
1793
|
+
confirmer_id
|
|
1794
|
+
pos
|
|
1795
|
+
draft_number
|
|
1796
|
+
voider_id
|
|
1797
|
+
exchange_rate
|
|
1798
|
+
currency_id
|
|
1799
|
+
voided_at
|
|
1800
|
+
payment_details {
|
|
1801
|
+
id
|
|
1802
|
+
payment_id
|
|
1803
|
+
invoice_id
|
|
1804
|
+
credit_note_id
|
|
1805
|
+
amount
|
|
1806
|
+
reference
|
|
1807
|
+
created_at
|
|
1808
|
+
updated_at
|
|
1809
|
+
entity_id
|
|
1810
|
+
contract_id
|
|
1811
|
+
contract_recurrence
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
`;
|
|
1816
|
+
};
|
|
1817
|
+
exports.getPaymentByIdStringQuery = getPaymentByIdStringQuery;
|
|
1818
|
+
const getInvoicesStringQuery = (options) => {
|
|
1819
|
+
const conditions = [];
|
|
1820
|
+
const rawLimit = options?.limit != null ? Number(options.limit) : 500;
|
|
1821
|
+
const limit = Number.isInteger(rawLimit) && rawLimit > 0 ? rawLimit : 500;
|
|
1822
|
+
if (options?.payeeIds?.length) {
|
|
1823
|
+
const ids = options.payeeIds.map((id) => requirePositiveInt(id, "payee id"));
|
|
1824
|
+
conditions.push(`payee_id: { _in: [${ids.join(", ")}] }`);
|
|
1825
|
+
}
|
|
1826
|
+
if (options?.voided !== undefined) {
|
|
1827
|
+
conditions.push(`voided: { _eq: ${Boolean(options.voided)} }`);
|
|
1828
|
+
}
|
|
1829
|
+
if (options?.paid !== undefined) {
|
|
1830
|
+
conditions.push(`paid: { _eq: ${Boolean(options.paid)} }`);
|
|
1831
|
+
}
|
|
1832
|
+
if (options?.issued !== undefined) {
|
|
1833
|
+
conditions.push(`issued: { _eq: ${Boolean(options.issued)} }`);
|
|
1834
|
+
}
|
|
1835
|
+
if (options?.lastId != null) {
|
|
1836
|
+
const lastId = Number(options.lastId);
|
|
1837
|
+
if (!Number.isInteger(lastId) || lastId < 0) {
|
|
1838
|
+
throw new Error("Invalid lastId");
|
|
1839
|
+
}
|
|
1840
|
+
conditions.push(`id: { _gt: ${lastId} }`);
|
|
1841
|
+
}
|
|
1842
|
+
const whereClause = conditions.length
|
|
1843
|
+
? `where: { ${conditions.join(", ")} }`
|
|
1844
|
+
: "";
|
|
1845
|
+
return `
|
|
1846
|
+
query getInvoices {
|
|
1847
|
+
invoices(
|
|
1848
|
+
${[whereClause, "order_by: { id: asc }", `limit: ${limit}`]
|
|
1849
|
+
.filter(Boolean)
|
|
1850
|
+
.join(", ")}
|
|
1851
|
+
) {
|
|
1852
|
+
id
|
|
1853
|
+
payee_id
|
|
1854
|
+
due
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
`;
|
|
1858
|
+
};
|
|
1859
|
+
exports.getInvoicesStringQuery = getInvoicesStringQuery;
|
|
1758
1860
|
const getInvoicesByAgencyIdStringQuery = (id, filters) => `
|
|
1759
1861
|
query getInvoicesByAgencyId {
|
|
1760
1862
|
invoices(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/graphql",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.12.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": "c8dd0d32d207bb10ce9ab3f5be040bb3b2e482c1"
|
|
27
27
|
}
|