@zauru-sdk/services 1.0.49 → 1.0.52

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 (108) hide show
  1. package/dist/cjs/common.js +235 -0
  2. package/dist/cjs/index.js +50 -0
  3. package/dist/cjs/sessions/sessions.js +18 -0
  4. package/dist/cjs/sessions/upstash.js +59 -0
  5. package/dist/cjs/zauru/httpGraphQL.js +42 -0
  6. package/dist/cjs/zauru/httpOauth.js +42 -0
  7. package/dist/cjs/zauru/httpZauru.js +42 -0
  8. package/dist/cjs/zauru/zauru-agencies.js +27 -0
  9. package/dist/cjs/zauru/zauru-automatic-numbers.js +28 -0
  10. package/dist/cjs/zauru/zauru-bookings.js +90 -0
  11. package/dist/cjs/zauru/zauru-bundles.js +104 -0
  12. package/dist/cjs/zauru/zauru-cases.js +30 -0
  13. package/dist/cjs/zauru/zauru-consolidated.js +81 -0
  14. package/dist/cjs/zauru/zauru-currencies.js +27 -0
  15. package/dist/cjs/zauru/zauru-deliveries.js +53 -0
  16. package/dist/cjs/zauru/zauru-discharges.js +55 -0
  17. package/dist/cjs/zauru/zauru-employees.js +30 -0
  18. package/dist/cjs/zauru/zauru-forms.js +363 -0
  19. package/dist/cjs/zauru/zauru-invoices.js +104 -0
  20. package/dist/cjs/zauru/zauru-items.js +293 -0
  21. package/dist/cjs/zauru/zauru-lote-record.js +33 -0
  22. package/dist/cjs/zauru/zauru-lotes.js +312 -0
  23. package/dist/cjs/zauru/zauru-motivos-rechazo.js +57 -0
  24. package/dist/cjs/zauru/zauru-payees.js +247 -0
  25. package/dist/cjs/zauru/zauru-payment-terms.js +75 -0
  26. package/dist/cjs/zauru/zauru-price-lists.js +49 -0
  27. package/dist/cjs/zauru/zauru-profiles.js +80 -0
  28. package/dist/cjs/zauru/zauru-purchase-orders.js +438 -0
  29. package/dist/cjs/zauru/zauru-receptions.js +104 -0
  30. package/dist/cjs/zauru/zauru-shipments.js +62 -0
  31. package/dist/cjs/zauru/zauru-suggested-prices.js +94 -0
  32. package/dist/cjs/zauru/zauru-tags.js +20 -0
  33. package/dist/cjs/zauru/zauru-templates.js +22 -0
  34. package/dist/cjs/zauru/zauru-variables.js +56 -0
  35. package/dist/cjs/zauru/zauru-web-app-tables.js +167 -0
  36. package/package.json +12 -9
  37. package/CHANGELOG.md +0 -232
  38. package/src/common.ts +0 -343
  39. package/src/index.ts +0 -37
  40. package/src/sessions/sessions.ts +0 -17
  41. package/src/sessions/upstash.ts +0 -55
  42. package/src/zauru/httpGraphQL.ts +0 -55
  43. package/src/zauru/httpOauth.ts +0 -55
  44. package/src/zauru/httpZauru.ts +0 -56
  45. package/src/zauru/zauru-agencies.ts +0 -32
  46. package/src/zauru/zauru-automatic-numbers.ts +0 -35
  47. package/src/zauru/zauru-bookings.ts +0 -134
  48. package/src/zauru/zauru-bundles.ts +0 -157
  49. package/src/zauru/zauru-cases.ts +0 -44
  50. package/src/zauru/zauru-consolidated.ts +0 -129
  51. package/src/zauru/zauru-currencies.ts +0 -39
  52. package/src/zauru/zauru-deliveries.ts +0 -70
  53. package/src/zauru/zauru-discharges.ts +0 -90
  54. package/src/zauru/zauru-employees.ts +0 -43
  55. package/src/zauru/zauru-forms.ts +0 -618
  56. package/src/zauru/zauru-invoices.ts +0 -142
  57. package/src/zauru/zauru-items.ts +0 -481
  58. package/src/zauru/zauru-lote-record.ts +0 -77
  59. package/src/zauru/zauru-lotes.ts +0 -484
  60. package/src/zauru/zauru-motivos-rechazo.ts +0 -121
  61. package/src/zauru/zauru-payees.ts +0 -402
  62. package/src/zauru/zauru-payment-terms.ts +0 -126
  63. package/src/zauru/zauru-price-lists.ts +0 -68
  64. package/src/zauru/zauru-profiles.ts +0 -106
  65. package/src/zauru/zauru-purchase-orders.ts +0 -701
  66. package/src/zauru/zauru-receptions.ts +0 -148
  67. package/src/zauru/zauru-shipments.ts +0 -88
  68. package/src/zauru/zauru-suggested-prices.ts +0 -137
  69. package/src/zauru/zauru-tags.ts +0 -22
  70. package/src/zauru/zauru-templates.ts +0 -24
  71. package/src/zauru/zauru-variables.ts +0 -67
  72. package/src/zauru/zauru-web-app-tables.ts +0 -256
  73. package/tsconfig.json +0 -24
  74. /package/dist/{common.js → esm/common.js} +0 -0
  75. /package/dist/{index.js → esm/index.js} +0 -0
  76. /package/dist/{sessions → esm/sessions}/sessions.js +0 -0
  77. /package/dist/{sessions → esm/sessions}/upstash.js +0 -0
  78. /package/dist/{zauru → esm/zauru}/httpGraphQL.js +0 -0
  79. /package/dist/{zauru → esm/zauru}/httpOauth.js +0 -0
  80. /package/dist/{zauru → esm/zauru}/httpZauru.js +0 -0
  81. /package/dist/{zauru → esm/zauru}/zauru-agencies.js +0 -0
  82. /package/dist/{zauru → esm/zauru}/zauru-automatic-numbers.js +0 -0
  83. /package/dist/{zauru → esm/zauru}/zauru-bookings.js +0 -0
  84. /package/dist/{zauru → esm/zauru}/zauru-bundles.js +0 -0
  85. /package/dist/{zauru → esm/zauru}/zauru-cases.js +0 -0
  86. /package/dist/{zauru → esm/zauru}/zauru-consolidated.js +0 -0
  87. /package/dist/{zauru → esm/zauru}/zauru-currencies.js +0 -0
  88. /package/dist/{zauru → esm/zauru}/zauru-deliveries.js +0 -0
  89. /package/dist/{zauru → esm/zauru}/zauru-discharges.js +0 -0
  90. /package/dist/{zauru → esm/zauru}/zauru-employees.js +0 -0
  91. /package/dist/{zauru → esm/zauru}/zauru-forms.js +0 -0
  92. /package/dist/{zauru → esm/zauru}/zauru-invoices.js +0 -0
  93. /package/dist/{zauru → esm/zauru}/zauru-items.js +0 -0
  94. /package/dist/{zauru → esm/zauru}/zauru-lote-record.js +0 -0
  95. /package/dist/{zauru → esm/zauru}/zauru-lotes.js +0 -0
  96. /package/dist/{zauru → esm/zauru}/zauru-motivos-rechazo.js +0 -0
  97. /package/dist/{zauru → esm/zauru}/zauru-payees.js +0 -0
  98. /package/dist/{zauru → esm/zauru}/zauru-payment-terms.js +0 -0
  99. /package/dist/{zauru → esm/zauru}/zauru-price-lists.js +0 -0
  100. /package/dist/{zauru → esm/zauru}/zauru-profiles.js +0 -0
  101. /package/dist/{zauru → esm/zauru}/zauru-purchase-orders.js +0 -0
  102. /package/dist/{zauru → esm/zauru}/zauru-receptions.js +0 -0
  103. /package/dist/{zauru → esm/zauru}/zauru-shipments.js +0 -0
  104. /package/dist/{zauru → esm/zauru}/zauru-suggested-prices.js +0 -0
  105. /package/dist/{zauru → esm/zauru}/zauru-tags.js +0 -0
  106. /package/dist/{zauru → esm/zauru}/zauru-templates.js +0 -0
  107. /package/dist/{zauru → esm/zauru}/zauru-variables.js +0 -0
  108. /package/dist/{zauru → esm/zauru}/zauru-web-app-tables.js +0 -0
@@ -1,256 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
- import {
4
- AxiosUtilsResponse,
5
- MotivoRechazo,
6
- RejectionWebAppTableObject,
7
- WebAppRowGraphQL,
8
- WebAppTableBody,
9
- WebAppTableCreateBody,
10
- WebAppTableGraphQL,
11
- WebAppTableUpdateResponse,
12
- } from "@zauru-sdk/types";
13
- import { getGraphQLAPIHeaders, getVariablesByName } from "../common.js";
14
- import httpGraphQLAPI from "./httpGraphQL.js";
15
- import {
16
- getWebAppRowStringQuery,
17
- getWebAppRowsByWebAppTableIdStringQuery,
18
- } from "@zauru-sdk/graphql";
19
- import httpZauru from "./httpZauru.js";
20
-
21
- /**
22
- * getWebAppRow
23
- * @param headers
24
- * @returns
25
- */
26
- export async function getWebAppRow<T>(
27
- session: Session,
28
- id: number
29
- ): Promise<AxiosUtilsResponse<T>> {
30
- return handlePossibleAxiosErrors(async () => {
31
- const headers = await getGraphQLAPIHeaders(session);
32
-
33
- const response = await httpGraphQLAPI.post<{
34
- data: { webapp_rows: WebAppRowGraphQL<T>[] };
35
- }>(
36
- "",
37
- {
38
- query: getWebAppRowStringQuery,
39
- variables: {
40
- id,
41
- },
42
- },
43
- { headers }
44
- );
45
-
46
- return response.data?.data?.webapp_rows[0]?.data;
47
- });
48
- }
49
-
50
- /**
51
- * getWebAppTableRegisters Function for get all web app table registers
52
- * @param headers
53
- * @param webapp_table_id web app table id
54
- * @returns
55
- */
56
- export async function getWebAppTableRegisters<T>(
57
- session: Session,
58
- webapp_table_id: string
59
- ): Promise<AxiosUtilsResponse<WebAppRowGraphQL<T>[]>> {
60
- return handlePossibleAxiosErrors(async () => {
61
- const headers = await getGraphQLAPIHeaders(session);
62
-
63
- const response = await httpGraphQLAPI.post<{
64
- data: { webapp_rows: WebAppRowGraphQL<T>[] };
65
- errors?: {
66
- message: string;
67
- extensions: { path: string; code: string };
68
- }[];
69
- }>(
70
- "",
71
- {
72
- query: getWebAppRowsByWebAppTableIdStringQuery,
73
- variables: {
74
- webapp_table_id,
75
- },
76
- },
77
- { headers }
78
- );
79
-
80
- if (response.data.errors) {
81
- throw new Error(response.data.errors.map((x) => x.message).join(";"));
82
- }
83
-
84
- if (!response?.data?.data.webapp_rows) {
85
- return [];
86
- }
87
-
88
- return response.data?.data?.webapp_rows;
89
- });
90
- }
91
-
92
- /**
93
- * deleteWebAppTableRegister Function for delete a web app table register
94
- * @param headers
95
- * @param id_web_app_table
96
- * @param id_register
97
- * @returns
98
- */
99
- export async function deleteWebAppTableRegister(
100
- headers: any,
101
- id_web_app_table: string,
102
- id_register: number
103
- ): Promise<WebAppTableUpdateResponse> {
104
- const response = await httpZauru<WebAppTableUpdateResponse>(
105
- `/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`,
106
- {
107
- method: "DELETE",
108
- headers: headers,
109
- }
110
- );
111
-
112
- return response.data;
113
- }
114
-
115
- /**
116
- * createWebAppTableRegister function for create a new web app table register
117
- * @param headers
118
- * @param body
119
- * @param id_web_app_table
120
- * @returns
121
- */
122
- export async function createWebAppTableRegister<T>(
123
- headers: any,
124
- id_web_app_table: string,
125
- body: T,
126
- extraBody?: { temp_purchase_order_id: string }
127
- ): Promise<WebAppTableUpdateResponse> {
128
- const requestBody = {
129
- webapp_row: { data: body },
130
- ...(extraBody ?? {}),
131
- } as WebAppTableBody<T>;
132
- const response = await httpZauru<WebAppTableUpdateResponse>(
133
- `/apps/webapp_tables/${id_web_app_table}/webapp_rows.json`,
134
- {
135
- method: "POST",
136
- headers: headers,
137
- data: requestBody,
138
- }
139
- );
140
-
141
- return response.data;
142
- }
143
-
144
- /**
145
- * updateWebAppTableRegister Function for update a web app table register
146
- * @param headers
147
- * @param id_web_app_table
148
- * @param id_register
149
- * @returns
150
- */
151
- export async function updateWebAppTableRegister<T>(
152
- headers: any,
153
- id_web_app_table: string,
154
- id_register: number | string,
155
- body: Partial<T>
156
- ): Promise<WebAppTableUpdateResponse> {
157
- const requestBody = { webapp_row: { data: body } } as WebAppTableBody<T>;
158
- const response = await httpZauru<WebAppTableUpdateResponse>(
159
- `/apps/webapp_tables/${id_web_app_table}/webapp_rows/${id_register}.json`,
160
- {
161
- method: "PATCH",
162
- headers: headers,
163
- data: requestBody,
164
- }
165
- );
166
-
167
- return response.data;
168
- }
169
-
170
- //============================== WEB APP TABLE
171
-
172
- /**
173
- *
174
- * @param headers
175
- * @param body
176
- * @returns
177
- */
178
- export async function createWebAppTable(
179
- headers: any,
180
- body: WebAppTableCreateBody
181
- ) {
182
- try {
183
- const response = await httpZauru.post<WebAppTableGraphQL>(
184
- `/apps/webapp_tables.json`,
185
- { webapp_table: body },
186
- {
187
- headers,
188
- }
189
- );
190
-
191
- return {
192
- data: response.data,
193
- error: false,
194
- } as AxiosUtilsResponse<WebAppTableGraphQL>;
195
- } catch (error) {
196
- return {
197
- msg: error,
198
- error: true,
199
- userMsg: `Ocurrió un error al intentar crear la web app table ${body.name}`,
200
- } as AxiosUtilsResponse<WebAppTableGraphQL>;
201
- }
202
- }
203
-
204
- /**
205
- * getWebappTable
206
- * @param headers
207
- * @param session
208
- * @returns
209
- */
210
- export const getRejectionWebAppTable = async (
211
- headers: any,
212
- session: Session
213
- ): Promise<AxiosUtilsResponse<RejectionWebAppTableObject>> => {
214
- return handlePossibleAxiosErrors(async () => {
215
- const {
216
- recepciones_rejections_webapp_table_id,
217
- recepciones_rejection_types_webapp_table_id,
218
- } = await getVariablesByName(headers, session, [
219
- "recepciones_rejections_webapp_table_id",
220
- "recepciones_rejection_types_webapp_table_id",
221
- ]);
222
-
223
- const webappTableResponse = await httpZauru.get<WebAppTableGraphQL>(
224
- `/apps/webapp_tables/${recepciones_rejections_webapp_table_id}.json`,
225
- { headers }
226
- );
227
-
228
- const webappTableRejectionsResponse = await httpZauru.get<
229
- WebAppRowGraphQL<MotivoRechazo>[]
230
- >(
231
- `/apps/webapp_tables/${recepciones_rejection_types_webapp_table_id}/webapp_rows.json`,
232
- { headers }
233
- );
234
-
235
- const rejections_select: { value: string; label: string }[] = [];
236
- const rejections_complete = webappTableRejectionsResponse.data;
237
- const keyName: string = Object.keys(rejections_complete[0].data)[0]; //get the first value
238
- const rejections_list: string[] = [];
239
- rejections_complete.forEach((val: any) => {
240
- rejections_list.push(val.data[keyName]);
241
- });
242
-
243
- rejections_complete.forEach((rc: any) => {
244
- rejections_select.push({
245
- value: rc.data[keyName],
246
- label: rc.data[keyName],
247
- });
248
- });
249
-
250
- return {
251
- webapp_table: webappTableResponse.data.structure,
252
- rejection_list: rejections_list,
253
- rejection_select: rejections_select,
254
- } as RejectionWebAppTableObject;
255
- });
256
- };
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
3
- "compilerOptions": {
4
- "allowSyntheticDefaultImports": true,
5
- "lib": ["ES2022"],
6
- "isolatedModules": true,
7
- "moduleResolution": "NodeNext",
8
- "module": "NodeNext",
9
- "esModuleInterop": true,
10
- "target": "ES2022",
11
- "strict": true,
12
- "allowJs": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "baseUrl": ".",
16
- "outDir": "./dist",
17
- "rootDir": "./src",
18
- "declaration": true,
19
- "declarationDir": "./dist",
20
- "paths": {
21
- "~/*": ["./src/*"]
22
- }
23
- }
24
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes