@zauru-sdk/services 1.0.5 → 1.0.7

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/common.server.d.ts +11 -10
  3. package/dist/common.server.js +44 -1
  4. package/dist/index.d.ts +22 -0
  5. package/dist/index.js +22 -0
  6. package/dist/zauru/httpZauru.server.d.ts +0 -12
  7. package/dist/zauru/httpZauru.server.js +0 -14
  8. package/dist/zauru/zauru-agencies.server.d.ts +1 -2
  9. package/dist/zauru/zauru-agencies.server.js +1 -1
  10. package/dist/zauru/zauru-automatic-numbers.server.d.ts +8 -0
  11. package/dist/zauru/zauru-automatic-numbers.server.js +21 -0
  12. package/dist/zauru/zauru-currencies.server.d.ts +6 -0
  13. package/dist/zauru/zauru-currencies.server.js +20 -0
  14. package/dist/zauru/zauru-deliveries.server.d.ts +22 -0
  15. package/dist/zauru/zauru-deliveries.server.js +44 -0
  16. package/dist/zauru/zauru-discharges.server.d.ts +26 -0
  17. package/dist/zauru/zauru-discharges.server.js +46 -0
  18. package/dist/zauru/zauru-employees.server.d.ts +6 -0
  19. package/dist/zauru/zauru-employees.server.js +23 -0
  20. package/dist/zauru/zauru-forms.server.d.ts +96 -0
  21. package/dist/zauru/zauru-forms.server.js +343 -0
  22. package/dist/zauru/zauru-invoices.server.d.ts +26 -0
  23. package/dist/zauru/zauru-invoices.server.js +94 -0
  24. package/dist/zauru/zauru-items.server.d.ts +91 -0
  25. package/dist/zauru/zauru-items.server.js +238 -0
  26. package/dist/zauru/zauru-lote-record.server.d.ts +8 -0
  27. package/dist/zauru/zauru-lote-record.server.js +26 -0
  28. package/dist/zauru/zauru-lotes.server.d.ts +91 -0
  29. package/dist/zauru/zauru-lotes.server.js +294 -0
  30. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +9 -0
  31. package/dist/zauru/zauru-motivos-rechazo.server.js +49 -0
  32. package/dist/zauru/zauru-payees.server.d.ts +97 -0
  33. package/dist/zauru/zauru-payees.server.js +227 -0
  34. package/dist/zauru/zauru-payment-terms.server.d.ts +20 -0
  35. package/dist/zauru/zauru-payment-terms.server.js +65 -0
  36. package/dist/zauru/zauru-price-lists.server.d.ts +22 -0
  37. package/dist/zauru/zauru-price-lists.server.js +40 -0
  38. package/dist/zauru/zauru-profiles.server.d.ts +1 -2
  39. package/dist/zauru/zauru-profiles.server.js +2 -1
  40. package/dist/zauru/zauru-purchase-orders.server.d.ts +160 -0
  41. package/dist/zauru/zauru-purchase-orders.server.js +414 -0
  42. package/dist/zauru/zauru-receptions.server.d.ts +33 -0
  43. package/dist/zauru/zauru-receptions.server.js +94 -0
  44. package/dist/zauru/zauru-shipments.server.d.ts +20 -0
  45. package/dist/zauru/zauru-shipments.server.js +53 -0
  46. package/dist/zauru/zauru-suggested-prices.server.d.ts +30 -0
  47. package/dist/zauru/zauru-suggested-prices.server.js +83 -0
  48. package/dist/zauru/zauru-tags.server.d.ts +7 -0
  49. package/dist/zauru/zauru-tags.server.js +13 -0
  50. package/dist/zauru/zauru-templates.server.d.ts +7 -0
  51. package/dist/zauru/zauru-templates.server.js +15 -0
  52. package/dist/zauru/zauru-variables.server.d.ts +14 -0
  53. package/dist/zauru/zauru-variables.server.js +48 -0
  54. package/dist/zauru/zauru-web-app-tables.server.d.ts +48 -0
  55. package/dist/zauru/zauru-web-app-tables.server.js +120 -0
  56. package/package.json +6 -5
  57. package/src/common.server.ts +61 -13
  58. package/src/index.ts +22 -0
  59. package/src/zauru/httpZauru.server.ts +1 -23
  60. package/src/zauru/zauru-agencies.server.ts +2 -3
  61. package/src/zauru/zauru-automatic-numbers.server.ts +35 -0
  62. package/src/zauru/zauru-currencies.server.ts +39 -0
  63. package/src/zauru/zauru-deliveries.server.ts +70 -0
  64. package/src/zauru/zauru-discharges.server.ts +90 -0
  65. package/src/zauru/zauru-employees.server.ts +43 -0
  66. package/src/zauru/zauru-forms.server.ts +618 -0
  67. package/src/zauru/zauru-invoices.server.ts +142 -0
  68. package/src/zauru/zauru-items.server.ts +427 -0
  69. package/src/zauru/zauru-lote-record.server.ts +77 -0
  70. package/src/zauru/zauru-lotes.server.ts +484 -0
  71. package/src/zauru/zauru-motivos-rechazo.server.ts +121 -0
  72. package/src/zauru/zauru-payees.server.ts +398 -0
  73. package/src/zauru/zauru-payment-terms.server.ts +126 -0
  74. package/src/zauru/zauru-price-lists.server.ts +68 -0
  75. package/src/zauru/zauru-profiles.server.ts +3 -2
  76. package/src/zauru/zauru-purchase-orders.server.ts +701 -0
  77. package/src/zauru/zauru-receptions.server.ts +148 -0
  78. package/src/zauru/zauru-shipments.server.ts +88 -0
  79. package/src/zauru/zauru-suggested-prices.server.ts +134 -0
  80. package/src/zauru/zauru-tags.server.ts +22 -0
  81. package/src/zauru/zauru-templates.server.ts +24 -0
  82. package/src/zauru/zauru-variables.server.ts +67 -0
  83. package/src/zauru/zauru-web-app-tables.server.ts +200 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.7](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.6...v1.0.7) (2024-03-16)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/services
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.6](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.5...v1.0.6) (2024-03-16)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/services
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.0.5](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.4...v1.0.5) (2024-03-16)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/services
@@ -1,7 +1,6 @@
1
1
  import { Session } from "@remix-run/node";
2
2
  import { AxiosRequestHeaders } from "axios";
3
- import { AxiosUtilsResponse } from "./zauru/httpZauru.server.js";
4
- import { EmployeeGraphQL, OauthProfile, ProfileResponse, AgencyGraphQL } from "@zauru-sdk/types";
3
+ import { EmployeeGraphQL, OauthProfile, ProfileResponse, AgencyGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
5
4
  /**
6
5
  * loginWebApp
7
6
  * @param session
@@ -16,14 +15,6 @@ export declare const loginWebApp: (session: Session, codeValue: string, cookie:
16
15
  userProfile: ProfileResponse;
17
16
  agencyProfile: AgencyGraphQL;
18
17
  }>>;
19
- export type GraphQLToken = {
20
- status: number;
21
- message: string;
22
- token: string;
23
- expires: string;
24
- expiresMsg: string;
25
- graphqlUrl: string;
26
- };
27
18
  /**
28
19
  * Obtiene los headers que se usan en todos los endpoints de zauru
29
20
  * @param cookie
@@ -52,3 +43,13 @@ export type SessionMessage = {
52
43
  export declare const saveSessionMessage: (session: Session, info: SessionMessage) => Promise<void>;
53
44
  export declare const deleteSessionMessage: (session: Session, id: string) => Promise<boolean>;
54
45
  export declare function generateDistinctCode(prefix: string): string;
46
+ /**
47
+ *
48
+ * @param headers
49
+ * @param session
50
+ * @param names
51
+ * @returns
52
+ */
53
+ export declare function getVariablesByName(headers: any, session: Session, names: Array<string>): Promise<{
54
+ [key: string]: string;
55
+ }>;
@@ -1,8 +1,10 @@
1
1
  import { redirect } from "@remix-run/node";
2
2
  import { commitSession, getSession } from "./sessions/sessions.server.js";
3
3
  import chalk from "chalk";
4
- import httpZauru, { handlePossibleAxiosErrors, } from "./zauru/httpZauru.server.js";
4
+ import httpZauru from "./zauru/httpZauru.server.js";
5
5
  import { getAgencyInfo, getEmployeeInfo, getOauthUserInfo, getProfileInformation, } from "./zauru/zauru-profiles.server.js";
6
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
7
+ import { getVariables } from "./zauru/zauru-variables.server.js";
6
8
  /**
7
9
  * loginWebApp
8
10
  * @param session
@@ -177,3 +179,44 @@ export function generateDistinctCode(prefix) {
177
179
  const codigoProducto = `${prefix}-${uuid}`;
178
180
  return codigoProducto;
179
181
  }
182
+ /**
183
+ *
184
+ * @param headers
185
+ * @param session
186
+ * @param names
187
+ * @returns
188
+ */
189
+ export async function getVariablesByName(headers, session, names) {
190
+ //variables
191
+ let variables = [];
192
+ //consulto si ya están guardadas en la sesión
193
+ const tempVars = session.get("variables");
194
+ if (Array.isArray(tempVars) && tempVars.length) {
195
+ //si ya están guardadas, uso esas
196
+ variables = tempVars;
197
+ }
198
+ else {
199
+ //si no están en la sesión, las obtengo de zauru y luego las guardo en la sesión
200
+ //Obtengo mis variables, para tener los tags solicitados
201
+ const response = await getVariables(headers);
202
+ if (response.error) {
203
+ throw new Error(`${response.userMsg} - ${response.msg}`);
204
+ }
205
+ session.set("variables", response.data);
206
+ await commitSession(session);
207
+ variables = response.data ?? [];
208
+ }
209
+ const filtrados = variables.filter((value) => names.includes(value.name));
210
+ const returnObject = {};
211
+ filtrados.forEach((variable) => {
212
+ returnObject[`${variable.name}`] = variable.value;
213
+ });
214
+ //Pregunto si todas las variables fueron encontradas o no
215
+ if (!names.every((variable) => Object.keys(returnObject).includes(variable))) {
216
+ const noEncontradas = names
217
+ .filter((variable) => !Object.keys(returnObject).includes(variable))
218
+ .join(",");
219
+ throw new Error(`No se encontraron las variables: ${noEncontradas} pruebe cerrar e iniciar sesión nuevamente para continuar.`);
220
+ }
221
+ return returnObject;
222
+ }
package/dist/index.d.ts CHANGED
@@ -5,4 +5,26 @@ export * from "./zauru/httpGraphQL.server.js";
5
5
  export * from "./zauru/httpOauth.server.js";
6
6
  export * from "./zauru/httpZauru.server.js";
7
7
  export * from "./zauru/zauru-agencies.server.js";
8
+ export * from "./zauru/zauru-automatic-numbers.server.js";
9
+ export * from "./zauru/zauru-currencies.server.js";
10
+ export * from "./zauru/zauru-deliveries.server.js";
11
+ export * from "./zauru/zauru-discharges.server.js";
12
+ export * from "./zauru/zauru-employees.server.js";
13
+ export * from "./zauru/zauru-forms.server.js";
14
+ export * from "./zauru/zauru-invoices.server.js";
15
+ export * from "./zauru/zauru-items.server.js";
16
+ export * from "./zauru/zauru-lote-record.server.js";
17
+ export * from "./zauru/zauru-lotes.server.js";
18
+ export * from "./zauru/zauru-motivos-rechazo.server.js";
19
+ export * from "./zauru/zauru-payees.server.js";
20
+ export * from "./zauru/zauru-payment-terms.server.js";
21
+ export * from "./zauru/zauru-price-lists.server.js";
22
+ export * from "./zauru/zauru-purchase-orders.server.js";
8
23
  export * from "./zauru/zauru-profiles.server.js";
24
+ export * from "./zauru/zauru-receptions.server.js";
25
+ export * from "./zauru/zauru-shipments.server.js";
26
+ export * from "./zauru/zauru-suggested-prices.server.js";
27
+ export * from "./zauru/zauru-tags.server.js";
28
+ export * from "./zauru/zauru-templates.server.js";
29
+ export * from "./zauru/zauru-web-app-tables.server.js";
30
+ export * from "./zauru/zauru-variables.server.js";
package/dist/index.js CHANGED
@@ -5,4 +5,26 @@ export * from "./zauru/httpGraphQL.server.js";
5
5
  export * from "./zauru/httpOauth.server.js";
6
6
  export * from "./zauru/httpZauru.server.js";
7
7
  export * from "./zauru/zauru-agencies.server.js";
8
+ export * from "./zauru/zauru-automatic-numbers.server.js";
9
+ export * from "./zauru/zauru-currencies.server.js";
10
+ export * from "./zauru/zauru-deliveries.server.js";
11
+ export * from "./zauru/zauru-discharges.server.js";
12
+ export * from "./zauru/zauru-employees.server.js";
13
+ export * from "./zauru/zauru-forms.server.js";
14
+ export * from "./zauru/zauru-invoices.server.js";
15
+ export * from "./zauru/zauru-items.server.js";
16
+ export * from "./zauru/zauru-lote-record.server.js";
17
+ export * from "./zauru/zauru-lotes.server.js";
18
+ export * from "./zauru/zauru-motivos-rechazo.server.js";
19
+ export * from "./zauru/zauru-payees.server.js";
20
+ export * from "./zauru/zauru-payment-terms.server.js";
21
+ export * from "./zauru/zauru-price-lists.server.js";
22
+ export * from "./zauru/zauru-purchase-orders.server.js";
8
23
  export * from "./zauru/zauru-profiles.server.js";
24
+ export * from "./zauru/zauru-receptions.server.js";
25
+ export * from "./zauru/zauru-shipments.server.js";
26
+ export * from "./zauru/zauru-suggested-prices.server.js";
27
+ export * from "./zauru/zauru-tags.server.js";
28
+ export * from "./zauru/zauru-templates.server.js";
29
+ export * from "./zauru/zauru-web-app-tables.server.js";
30
+ export * from "./zauru/zauru-variables.server.js";
@@ -1,14 +1,2 @@
1
- export type AxiosUtilsResponse<T> = {
2
- error?: boolean;
3
- msg?: string;
4
- userMsg?: string;
5
- data?: T;
6
- };
7
- /**
8
- * Handle web app table actions and return a response with a consistent format.
9
- * @param action A function that returns a Promise of type T.
10
- * @returns A Promise of AxiosUtilsResponse<T>.
11
- */
12
- export declare function handlePossibleAxiosErrors<T>(action: () => Promise<T>): Promise<AxiosUtilsResponse<T>>;
13
1
  declare const httpZauru: import("axios").AxiosInstance;
14
2
  export default httpZauru;
@@ -1,20 +1,6 @@
1
1
  import axios from "axios";
2
2
  import chalk from "chalk";
3
3
  import { config } from "@zauru-sdk/config";
4
- /**
5
- * Handle web app table actions and return a response with a consistent format.
6
- * @param action A function that returns a Promise of type T.
7
- * @returns A Promise of AxiosUtilsResponse<T>.
8
- */
9
- export async function handlePossibleAxiosErrors(action) {
10
- try {
11
- const result = await action();
12
- return { error: false, data: result };
13
- }
14
- catch (error) {
15
- return { error: true, userMsg: error?.toString() };
16
- }
17
- }
18
4
  const axiosInstance = axios.create({
19
5
  baseURL: `${config.zauruBaseURL}`,
20
6
  });
@@ -1,6 +1,5 @@
1
1
  import type { Session } from "@remix-run/node";
2
- import type { AxiosUtilsResponse } from "./httpZauru.server.js";
3
- import type { AgencyGraphQL } from "@zauru-sdk/types";
2
+ import type { AgencyGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
4
3
  /**
5
4
  * getAgencies
6
5
  * @param headers
@@ -1,4 +1,4 @@
1
- import { handlePossibleAxiosErrors } from "./httpZauru.server.js";
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
2
  import httpGraphQLAPI from "./httpGraphQL.server.js";
3
3
  import { getGraphQLAPIHeaders } from "~/common.server.js";
4
4
  import { getAgenciesStringQuery } from "@zauru-sdk/graphql";
@@ -0,0 +1,8 @@
1
+ import { DocumentAutomaticNumberGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
2
+ /**
3
+ * updateAutomaticNumber
4
+ * @param headers
5
+ * @param body
6
+ * @returns
7
+ */
8
+ export declare const updateAutomaticNumber: (headers: any, body: Partial<DocumentAutomaticNumberGraphQL>) => Promise<AxiosUtilsResponse<DocumentAutomaticNumberGraphQL>>;
@@ -0,0 +1,21 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import httpZauru from "./httpZauru.server.js";
3
+ /**
4
+ * updateAutomaticNumber
5
+ * @param headers
6
+ * @param body
7
+ * @returns
8
+ */
9
+ export const updateAutomaticNumber = async (headers, body) => {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const sendBody = {
12
+ document_automatic_number: {
13
+ ...body,
14
+ },
15
+ };
16
+ const response = await httpZauru.put(`/settings/templates/document_automatic_numbers/${body.id}.json`, sendBody, {
17
+ headers,
18
+ });
19
+ return response.data;
20
+ });
21
+ };
@@ -0,0 +1,6 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, CurrencyGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getCurrencies
5
+ */
6
+ export declare function getCurrencies(session: Session): Promise<AxiosUtilsResponse<CurrencyGraphQL[]>>;
@@ -0,0 +1,20 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
3
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
4
+ import { getCurrenciesStringQuery } from "@zauru-sdk/graphql";
5
+ /**
6
+ * getCurrencies
7
+ */
8
+ export async function getCurrencies(session) {
9
+ return handlePossibleAxiosErrors(async () => {
10
+ const headers = await getGraphQLAPIHeaders(session);
11
+ const response = await httpGraphQLAPI.post("", {
12
+ query: getCurrenciesStringQuery,
13
+ }, { headers });
14
+ if (response.data.errors) {
15
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
16
+ }
17
+ const registers = response?.data?.data?.currencies;
18
+ return registers;
19
+ });
20
+ }
@@ -0,0 +1,22 @@
1
+ import { AxiosUtilsResponse, DataTablesFilterBody, HTMLDataTableDeliveries, ShipmentGraphQL } from "@zauru-sdk/types";
2
+ /**
3
+ * getDelivery
4
+ * @param headers
5
+ * @param body
6
+ * @returns
7
+ */
8
+ export declare function getDelivery(headers: any, idDelivery: string): Promise<AxiosUtilsResponse<ShipmentGraphQL>>;
9
+ /**
10
+ * GET DELIVERIES DATA TABLES
11
+ * @param headers
12
+ * @param body
13
+ * @returns
14
+ */
15
+ export declare function getDeliveriesDataTables(headers: any, body: DataTablesFilterBody): Promise<AxiosUtilsResponse<HTMLDataTableDeliveries>>;
16
+ /**
17
+ * deleteDelivery
18
+ * @param headers
19
+ * @param id
20
+ * @returns
21
+ */
22
+ export declare function deleteDelivery(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
@@ -0,0 +1,44 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import httpZauru from "./httpZauru.server.js";
3
+ /**
4
+ * getDelivery
5
+ * @param headers
6
+ * @param body
7
+ * @returns
8
+ */
9
+ export async function getDelivery(headers, idDelivery) {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const response = await httpZauru.get(`/inventories/deliveries/${idDelivery}.json`, {
12
+ headers,
13
+ });
14
+ return response.data;
15
+ });
16
+ }
17
+ /**
18
+ * GET DELIVERIES DATA TABLES
19
+ * @param headers
20
+ * @param body
21
+ * @returns
22
+ */
23
+ export async function getDeliveriesDataTables(headers, body) {
24
+ return handlePossibleAxiosErrors(async () => {
25
+ const response = await httpZauru.post(`/inventories/deliveries/datatables.json`, body, {
26
+ headers,
27
+ });
28
+ return response.data;
29
+ });
30
+ }
31
+ /**
32
+ * deleteDelivery
33
+ * @param headers
34
+ * @param id
35
+ * @returns
36
+ */
37
+ export async function deleteDelivery(headers, id) {
38
+ return handlePossibleAxiosErrors(async () => {
39
+ await httpZauru.delete(`/inventories/deliveries/${id}.json?destroy=true`, {
40
+ headers,
41
+ });
42
+ return true;
43
+ });
44
+ }
@@ -0,0 +1,26 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, GeneratePDFBody, NewDischargeBody, PDFResult } from "@zauru-sdk/types";
3
+ /**
4
+ *
5
+ * @param headers
6
+ * @returns
7
+ */
8
+ export declare const createDischarge: (session: Session, headers: any, body: NewDischargeBody) => Promise<AxiosUtilsResponse<{
9
+ id: number;
10
+ }>>;
11
+ /**
12
+ * generateDischargePDF
13
+ * @param headers
14
+ * @param body
15
+ */
16
+ export declare const generateDischargePDF: (headers: any, session: Session, body: GeneratePDFBody) => Promise<AxiosUtilsResponse<{
17
+ status: number;
18
+ zid: number;
19
+ }>>;
20
+ /**
21
+ * getDischargePDFResult
22
+ * @param headers
23
+ * @param zid
24
+ * @returns
25
+ */
26
+ export declare const getDischargePDFResult: (headers: any, zid: number | string) => Promise<AxiosUtilsResponse<PDFResult>>;
@@ -0,0 +1,46 @@
1
+ import { getVariablesByName } from "~/common.server.js";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import httpZauru from "./httpZauru.server.js";
4
+ /**
5
+ *
6
+ * @param headers
7
+ * @returns
8
+ */
9
+ export const createDischarge = async (session, headers, body) => {
10
+ return handlePossibleAxiosErrors(async () => {
11
+ const { id_check_discharge_method } = await getVariablesByName(headers, session, ["id_check_discharge_method"]);
12
+ body.discharge.discharge_method_id = id_check_discharge_method;
13
+ const response = await httpZauru.post(`/purchases/discharges.json`, body, {
14
+ headers,
15
+ });
16
+ return response.data;
17
+ });
18
+ };
19
+ /**
20
+ * generateDischargePDF
21
+ * @param headers
22
+ * @param body
23
+ */
24
+ export const generateDischargePDF = async (headers, session, body) => {
25
+ return handlePossibleAxiosErrors(async () => {
26
+ const { consolidated_template_id } = await getVariablesByName(headers, session, ["consolidated_template_id"]);
27
+ body.print_template = consolidated_template_id;
28
+ const response = await httpZauru.post("/purchases/consolidates/gen_print_all.json", body, { headers });
29
+ return response.data;
30
+ });
31
+ };
32
+ /**
33
+ * getDischargePDFResult
34
+ * @param headers
35
+ * @param zid
36
+ * @returns
37
+ */
38
+ export const getDischargePDFResult = async (headers, zid) => {
39
+ return handlePossibleAxiosErrors(async () => {
40
+ const response = await httpZauru.get("purchases/consolidates/check_print_all", {
41
+ headers,
42
+ params: { zid },
43
+ });
44
+ return response.data;
45
+ });
46
+ };
@@ -0,0 +1,6 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, EmployeeGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getEmployeesByAgencyId
5
+ */
6
+ export declare function getEmployeesByAgencyId(session: Session, id: number | string): Promise<AxiosUtilsResponse<EmployeeGraphQL[]>>;
@@ -0,0 +1,23 @@
1
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
3
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
4
+ import { getEmployeesByAgencyIdStringQuery } from "@zauru-sdk/graphql";
5
+ /**
6
+ * getEmployeesByAgencyId
7
+ */
8
+ export async function getEmployeesByAgencyId(session, id) {
9
+ return handlePossibleAxiosErrors(async () => {
10
+ const headers = await getGraphQLAPIHeaders(session);
11
+ const response = await httpGraphQLAPI.post("", {
12
+ query: getEmployeesByAgencyIdStringQuery,
13
+ variables: {
14
+ id,
15
+ },
16
+ }, { headers });
17
+ if (response.data.errors) {
18
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
19
+ }
20
+ const registers = response?.data?.data?.employees;
21
+ return registers;
22
+ });
23
+ }
@@ -0,0 +1,96 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { AxiosUtilsResponse, FormDocumentType, FormGraphQL, FormSubmissionGraphQL, SubmissionCasesGraphQL, SubmissionInvoicesGraphQL } from "@zauru-sdk/types";
3
+ /**
4
+ * getForms
5
+ */
6
+ export declare function getForms(session: Session): Promise<AxiosUtilsResponse<FormGraphQL[]>>;
7
+ /**
8
+ * getFormByName
9
+ */
10
+ export declare function getFormByName(session: Session, name: string): Promise<AxiosUtilsResponse<FormGraphQL>>;
11
+ /**
12
+ * getFormsByDocumentType
13
+ */
14
+ export declare function getFormsByDocumentType(session: Session, document_type: FormDocumentType, filters?: {
15
+ formZid?: number;
16
+ }): Promise<AxiosUtilsResponse<FormGraphQL[]>>;
17
+ /**
18
+ * getFormSubmissionById
19
+ */
20
+ export declare function getFormSubmissionById(headersZauru: any, session: Session, id: string | number, config?: {
21
+ withFiles?: boolean;
22
+ }): Promise<AxiosUtilsResponse<FormSubmissionGraphQL>>;
23
+ /**
24
+ * getInvoiceFormSubmissionsByAgencyId
25
+ */
26
+ export declare function getInvoiceFormSubmissionsByAgencyId(session: Session, agency_id: string, filters?: {
27
+ startDate?: string;
28
+ endDate?: string;
29
+ seller_id?: string | number;
30
+ payee_id_number_search?: string;
31
+ some_field_value?: string;
32
+ item_ids?: number[];
33
+ bundle_ids?: number[];
34
+ }): Promise<AxiosUtilsResponse<SubmissionInvoicesGraphQL[]>>;
35
+ /**
36
+ * getMyCaseFormSubmissions
37
+ */
38
+ export declare function getMyCaseFormSubmissions(headersZauru: any, session: Session, filters?: {
39
+ formZid?: number;
40
+ caseId?: number;
41
+ }, config?: {
42
+ withFiles?: boolean;
43
+ }): Promise<AxiosUtilsResponse<SubmissionCasesGraphQL[]>>;
44
+ /**
45
+ * getLastInvoiceFormSubmission
46
+ * @param session
47
+ * @param filters
48
+ * @returns
49
+ */
50
+ export declare function getLastInvoiceFormSubmission(session: Session, filters?: {
51
+ formZid?: number;
52
+ }): Promise<AxiosUtilsResponse<SubmissionInvoicesGraphQL>>;
53
+ /**
54
+ * getInvoiceFormSubmissionsByInvoiceId
55
+ */
56
+ export declare function getInvoiceFormSubmissionsByInvoiceId(session: Session, invoice_id: string, filters?: {
57
+ formZid?: number;
58
+ }): Promise<AxiosUtilsResponse<SubmissionInvoicesGraphQL[]>>;
59
+ /**
60
+ * createForm
61
+ * @param headers
62
+ * @param body
63
+ */
64
+ export declare function createForm(headers: any, body: Partial<FormGraphQL>): Promise<AxiosUtilsResponse<FormGraphQL>>;
65
+ /**
66
+ * deleteForm
67
+ * @param headers
68
+ * @param body
69
+ */
70
+ export declare function deleteForm(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;
71
+ /**
72
+ * createForm
73
+ * @param headers
74
+ * @param body
75
+ */
76
+ export declare function updateForm(headers: any, body: Partial<FormGraphQL>): Promise<AxiosUtilsResponse<FormGraphQL>>;
77
+ /**
78
+ * createFormSubmission
79
+ * @param headers
80
+ * @param body
81
+ * @returns
82
+ */
83
+ export declare function createFormSubmission(headers: any, body: Partial<FormSubmissionGraphQL>): Promise<AxiosUtilsResponse<FormSubmissionGraphQL>>;
84
+ /**
85
+ * updateSubmissionInvoiceFormSubmission
86
+ * @param headers
87
+ * @param body
88
+ * @returns
89
+ */
90
+ export declare function updateSubmissionInvoiceFormSubmission(headers: any, body: Partial<SubmissionInvoicesGraphQL>): Promise<AxiosUtilsResponse<FormSubmissionGraphQL>>;
91
+ /**
92
+ * deleteFormSubmission
93
+ * @param headers
94
+ * @param body
95
+ */
96
+ export declare function deleteFormSubmission(headers: any, id: string | number): Promise<AxiosUtilsResponse<boolean>>;