@zauru-sdk/graphql 1.0.93 → 1.0.105

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.
@@ -1,12 +1,12 @@
1
- export declare const getLast100ReceptionsStringQuery = "\nquery getLast100Receptions($agencyId: Int) @cached {\n purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {\n id\n created_at\n due\n id_number\n memo\n payee_id\n issue_date\n discount\n other_charges\n authorized\n received\n transport_type\n purchase_order_details {\n item_id\n id\n reference\n booked_quantity\n delivered_quantity\n }\n lots(where: {active: {_eq: true}}) {\n id\n name\n description\n item_id\n }\n }\n}\n";
2
- export declare const getPurchaseOrderByIdNumberStringQuery = "\nquery getPurchaseOrderByIdNumber($id_number: String) @cached {\n purchase_orders(where: {id_number: {_eq: $id_number}}) {\n id\n created_at\n due\n id_number\n memo\n payee_id\n transport_type\n reference\n incoterm_destination\n issue_date\n voided\n received\n discount\n other_charges\n webapp_table_rowables {\n webapp_rows {\n data\n }\n }\n purchase_order_details {\n item_id\n id\n reference\n booked_quantity\n delivered_quantity\n }\n lots(where: {active: {_eq: true}}) {\n id\n description\n }\n receptions {\n id\n received\n voided\n }\n shipments {\n shipment_id\n }\n }\n}\n";
3
- export declare const getPurchaseOrderStringQuery: (config?: {
1
+ export declare const getLast100ReceptionsStringQuery: (agency_id: number) => string;
2
+ export declare const getPurchaseOrderByIdNumberStringQuery: (id_number: string) => string;
3
+ export declare const getPurchaseOrderStringQuery: (id: number, config?: {
4
4
  withLotStocks: boolean;
5
5
  }) => string;
6
- export declare const getShipmentsByToAgencyLast100StringQuery = "\nquery getShipmentsByToAgencyLast100(\n $agency_to_id: Int\n ){\n shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {\n id\n zid\n id_number\n reference\n needs_transport\n payee_id\n income\n booker_id\n agency_from_id\n agency_to_id\n transporter_id\n created_at\n movements {\n id\n booked_quantity\n delivered_quantity\n reference\n lot {\n id\n name\n description\n }\n }\n }\n }\n";
7
- export declare const getLotsByNameStringQuery = "\nquery getLots($name: String, $entity_id: Int){\n lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {\n id\n name\n description\n }\n}\n";
8
- export declare const getLotStocksByAgencyIdStringQuery = "\nquery getLotStocksByAgencyId($agency_id: Int){\n lot_stocks (\n order_by: { id: desc },\n where: { agency_id: { _eq: $agency_id }}\n ){\n id\n available\n lot_id\n lot {\n id\n item_id\n expires\n }\n }\n}\n";
9
- export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
6
+ export declare const getShipmentsByToAgencyLast100StringQuery: (agency_to_id: number) => string;
7
+ export declare const getLotsByNameStringQuery: (name: string, entity_id: number) => string;
8
+ export declare const getLotStocksByAgencyIdStringQuery: (agency_id: number) => string;
9
+ export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: string, endDate: string, config: {
10
10
  agencyId?: number | string;
11
11
  itemId?: number | string;
12
12
  payeeCategoryId?: number | string;
@@ -27,40 +27,40 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
27
27
  export declare const getPayeesStringQuery = "\nquery getPayees {\n payees {\n id\n id_number\n name\n tin\n vendor\n address_line_1\n }\n}\n";
28
28
  export declare const getProvidersStringQuery = "\nquery getProviders {\n payees (where: {vendor: {_eq: true}}) {\n id\n id_number\n name\n tin\n address_line_1\n }\n}\n";
29
29
  export declare const getAgenciesStringQuery = "\nquery getAgencies {\n agencies {\n id\n name\n }\n}\n";
30
- export declare const getWebAppRowStringQuery = "\nquery getWebAppRow($id: Int){\n webapp_rows(where: {id: {_eq: $id}}) {\n data\n }\n}\n";
31
- export declare const getWebAppRowsByWebAppTableIdStringQuery = "\nquery getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {\n webapp_rows (\n where: {\n webapp_table_id: {\n _eq: $webapp_table_id \n }\n },\n order_by: { \n id: desc \n }\n ) {\n id\n data\n created_at\n }\n}\n";
32
- export declare const getPayeeCategoryByIdStringQuery = "\nquery getPayeeCategoryById ($id: Int) {\n payee_categories (where: {id: {_eq: $id }}) {\n payees (order_by: { id: desc }) { \n id\n name\n id_number\n email\n phone\n tin\n active\n address_line_1\n vendor\n }\n }\n}\n";
30
+ export declare const getWebAppRowStringQuery: (id: number) => string;
31
+ export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number) => string;
32
+ export declare const getPayeeCategoryByIdStringQuery: (id: number) => string;
33
33
  export declare const getPayeeCategoriesByNotesMatchStringQuery: (match: string) => string;
34
34
  export declare const getPayeeCategoriesStringQuery = "\nquery getPayeeCategories {\n payee_categories {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
35
35
  export declare const getProviderCategoriesStringQuery = "\nquery getProviderCategories {\n payee_categories (where: {vendor: {_eq: true}}) {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
36
36
  export declare const getClientCategoriesStringQuery = "\nquery getClientCategories {\n payee_categories (where: {vendor: {_eq: false}}) {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
37
- export declare const getPayeeByIdStringQuery = "\nquery getPayeeById ($id: Int) {\n payees (where: {id: {_eq: $id }}) {\n id\n name\n id_number\n email\n phone\n tin\n active\n address_line_1\n }\n}\n";
38
- export declare const getSuperCategoryByIdStringQuery = "\nquery getSuperCategoryById ($id: bigint) {\n item_super_categories (where: {id: {_eq: $id }}) {\n item_categories {\n id\n name\n notes\n items_count\n }\n }\n}\n";
39
- export declare const getItemCategoryByIdStringQuery = "\nquery getItemCategoryById ($id: Int) {\n item_categories (where: {id: {_eq: $id }}) {\n id\n name\n notes\n items_count\n }\n}\n";
40
- export declare const getItemsByCategoryStringQuery = "\nquery getItemsByCategory ($id: Int) {\n item_categories (where: {id: {_eq: $id }}) {\n items (where: {active: {_eq: true }}) {\n id,\n name,\n stocks_only_integer,\n code\n product_type\n }\n }\n}\n";
37
+ export declare const getPayeeByIdStringQuery: (id: number) => string;
38
+ export declare const getSuperCategoryByIdStringQuery: (id: number) => string;
39
+ export declare const getItemCategoryByIdStringQuery: (id: number) => string;
40
+ export declare const getItemsByCategoryStringQuery: (id: number) => string;
41
41
  export declare const getItemsStringQuery = "\nquery getItems {\n items (where: {active: {_eq: true }}) {\n id,\n name,\n code\n }\n}\n";
42
- export declare const getItemsBySuperCategoryStringQuery = "\nquery getItemsBySuperCategory ($id: bigint, $agency_id: Int) {\n item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {\n item_categories {\n items (where: {active: {_eq: true }}) {\n id,\n name,\n stocks_only_integer,\n code,\n item_category_id,\n measurement_unit,\n description\n product_type\n stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {\n available\n id\n incoming\n outgoing\n }\n }\n }\n }\n}\n";
43
- export declare const getConsolidatesBetweenDatesStringQuery = "\nquery getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {\n consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {\n id\n id_number\n created_at\n name\n purchase_orders {\n id\n due\n }\n }\n}\n";
44
- export declare const getEmployeeProfileStringQuery = "\nquery getEmployeeProfile ($id: Int) {\n employees(where: {id: {_eq: $id}}) {\n agency_id\n email\n entity_id\n id\n name\n user_id\n seller\n active\n accountant\n inventory_controller\n buyer\n support_agent\n }\n}\n";
45
- export declare const getEmployeesByAgencyIdStringQuery = "\nquery getEmployeesByAgencyId ($id: Int) {\n employees(where: {agency_id: {_eq: $id}}) {\n name\n id\n user_id\n email\n seller\n active\n accountant\n inventory_controller\n buyer\n support_agent\n }\n}\n";
46
- export declare const getBundlesByItemCategoryIdStringQuery = "\nquery getBundlesByItemCategoryId ($id: Int) {\n bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {\n id\n code\n description\n name\n updated_at\n image5\n bundle_details_count\n bundle_details {\n id\n item_id\n quantity\n }\n }\n}\n";
47
- export declare const getBundleByNameStringQuery = "\nquery getBundleByName ($name: String) {\n bundles (where: {name: {_eq: $name }}) {\n id\n }\n}\n";
48
- export declare const getItemByNameStringQuery = "\nquery getItemByName ($name: String) {\n items (where: {active: {_eq: true }, name: {_eq: $name }}) {\n id\n name\n stocks_only_integer\n code\n product_type\n }\n}\n";
42
+ export declare const getItemsBySuperCategoryStringQuery: (id: number, agency_id: number) => string;
43
+ export declare const getConsolidatesBetweenDatesStringQuery: (startDate: string, endDate: string) => string;
44
+ export declare const getEmployeeProfileStringQuery: (id: number) => string;
45
+ export declare const getEmployeesByAgencyIdStringQuery: (id: number) => string;
46
+ export declare const getBundlesByItemCategoryIdStringQuery: (id: number) => string;
47
+ export declare const getBundleByNameStringQuery: (name: string) => string;
48
+ export declare const getItemByNameStringQuery: (name: string) => string;
49
49
  export declare const getShipmentsStringQuery: (wheres?: string[]) => string;
50
50
  export declare const getAllFormsStringQuery: (config?: {
51
51
  withSubmissions: boolean;
52
52
  }) => string;
53
- export declare const getFormByNameStringQuery = "\nquery getFormByName ($name: String) {\n settings_forms (\n where: {name: {_eq: $name }},\n order_by: {zid: desc, version: desc}\n ) {\n id\n zid\n name\n description\n version\n active\n settings_form_fields (order_by: {position: asc}) {\n id\n name\n field_type\n hint\n required\n default_value\n position\n print_var_name\n form_id\n settings_form_field_options {\n id\n label\n position\n value\n }\n }\n }\n}\n";
53
+ export declare const getFormByNameStringQuery: (name: string) => string;
54
54
  export declare const getFormsStringQuery = "\nquery getForms {\n settings_forms (\n order_by: {zid: desc, version: desc}\n ) {\n id\n zid\n name\n description\n version\n active\n settings_form_fields (order_by: {position: asc}) {\n id\n name\n field_type\n hint\n required\n default_value\n position\n print_var_name\n form_id\n settings_form_field_options {\n id\n label\n position\n value\n }\n }\n }\n}\n";
55
- export declare const getFormsByDocumentTypeStringQuery: (filters?: {
55
+ export declare const getFormsByDocumentTypeStringQuery: (document_type: string, filters?: {
56
56
  formZid?: number;
57
57
  }) => string;
58
- export declare const getMyCaseFormSubmissionsStringQuery: (filters?: {
58
+ export declare const getMyCaseFormSubmissionsStringQuery: (responsible_id: number, filters?: {
59
59
  formZid?: number;
60
60
  caseId?: number;
61
61
  }) => string;
62
- export declare const getFormSubmissionByIdStringQuery = "\nquery getFormSubmissionById ($formId: bigint) {\n settings_form_submissions (where: {id: { _eq: $formId }}) {\n id\n zid\n reference\n created_at\n version\n id_number\n settings_form {\n id\n name\n description\n }\n settings_form_submission_values {\n id\n form_field_id\n value\n settings_form_field {\n id\n name\n print_var_name\n field_type\n settings_form_field_options {\n id\n label\n position\n value\n }\n }\n }\n }\n}\n";
63
- export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (filters?: {
62
+ export declare const getFormSubmissionByIdStringQuery: (formId: number) => string;
63
+ export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (agency_id: number, filters?: {
64
64
  seller_id?: number | string;
65
65
  payee_id_number_search?: string;
66
66
  some_field_value?: string;
@@ -73,7 +73,7 @@ export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (filters?:
73
73
  export declare const getLastInvoiceFormSubmissionStringQuery: (filters?: {
74
74
  formZid?: number;
75
75
  }) => string;
76
- export declare const getInvoiceFormSubmissionsByInvoiceIdStringQuery: (filters?: {
76
+ export declare const getInvoiceFormSubmissionsByInvoiceIdStringQuery: (invoice_id: number, filters?: {
77
77
  formZid?: number;
78
78
  }) => string;
79
79
  export declare const getCurrenciesStringQuery = "\nquery getCurrencies {\n currencies {\n id\n name\n prefix\n code\n country\n plural_name\n }\n}\n";
@@ -89,7 +89,7 @@ export declare const getPaymentTermsStringQuery: (config?: {
89
89
  export declare const getPaymentMethodsStringQuery: (config: {
90
90
  onlyActives: boolean;
91
91
  }) => string;
92
- export declare const getPaymentTermByIdStringQuery = "\nquery getPaymentTermById ($id: Int) {\n payment_terms (where: {id: {_eq: $id }}) {\n active\n id\n memo\n name\n account_from_id\n account_to_id\n allowed_payment_terms {\n payee_category_id\n }\n }\n}\n";
93
- export declare const getInvoicesByAgencyIdStringQuery = "\nquery getInvoicesByAgencyId($id: Int) {\n invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {\n id\n zid\n id_number\n currency_id\n date\n payee_id\n total\n subtotal\n seller_id\n order_number\n memo\n issued\n invoice_number\n id_number\n payment_term_id\n reference\n submission_invoices {\n id\n settings_form_submission {\n zid\n voided\n settings_form {\n id\n zid\n }\n }\n }\n invoice_details {\n bundle_id\n id\n item_bundle_name\n item_bundle_description\n item_id\n price\n quantity\n unit_price\n }\n payee {\n name\n payee_category_id\n }\n }\n}\n";
94
- export declare const getCasesByResponsibleIdStringQuery: (wheres?: string[]) => string;
92
+ export declare const getPaymentTermByIdStringQuery: (id: number) => string;
93
+ export declare const getInvoicesByAgencyIdStringQuery: (id: number) => string;
94
+ export declare const getCasesByResponsibleIdStringQuery: (responsible_id: number, wheres?: string[]) => string;
95
95
  export declare const getPrintTemplatesStringQuery = "\nquery getPrintTemplates {\n print_templates {\n id\n name\n }\n}\n";
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = exports.getShipmentsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = 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.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsByToAgencyLast100StringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
- exports.getLast100ReceptionsStringQuery = `
5
- query getLast100Receptions($agencyId: Int) @cached {
6
- purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {
4
+ const getLast100ReceptionsStringQuery = (agency_id) => `
5
+ query getLast100Receptions {
6
+ purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
7
7
  id
8
8
  created_at
9
9
  due
@@ -32,9 +32,10 @@ query getLast100Receptions($agencyId: Int) @cached {
32
32
  }
33
33
  }
34
34
  `;
35
- exports.getPurchaseOrderByIdNumberStringQuery = `
36
- query getPurchaseOrderByIdNumber($id_number: String) @cached {
37
- purchase_orders(where: {id_number: {_eq: $id_number}}) {
35
+ exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
36
+ const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
37
+ query getPurchaseOrderByIdNumber {
38
+ purchase_orders(where: {id_number: {_eq: "${id_number}"}}) {
38
39
  id
39
40
  created_at
40
41
  due
@@ -76,9 +77,10 @@ query getPurchaseOrderByIdNumber($id_number: String) @cached {
76
77
  }
77
78
  }
78
79
  `;
79
- const getPurchaseOrderStringQuery = (config = { withLotStocks: false }) => `
80
- query getPurchaseOrder($id: Int) @cached {
81
- purchase_orders(where: {id: {_eq: $id}}) {
80
+ exports.getPurchaseOrderByIdNumberStringQuery = getPurchaseOrderByIdNumberStringQuery;
81
+ const getPurchaseOrderStringQuery = (id, config = { withLotStocks: false }) => `
82
+ query getPurchaseOrder($id: bigint) @cached {
83
+ purchase_orders(where: {id: {_eq: ${id}}}) {
82
84
  id
83
85
  agency_id
84
86
  entity_id
@@ -147,11 +149,9 @@ query getPurchaseOrder($id: Int) @cached {
147
149
  }
148
150
  `;
149
151
  exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
150
- exports.getShipmentsByToAgencyLast100StringQuery = `
151
- query getShipmentsByToAgencyLast100(
152
- $agency_to_id: Int
153
- ){
154
- shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
152
+ const getShipmentsByToAgencyLast100StringQuery = (agency_to_id) => `
153
+ query getShipmentsByToAgencyLast100 {
154
+ shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: ${agency_to_id}}}) {
155
155
  id
156
156
  zid
157
157
  id_number
@@ -178,20 +178,22 @@ query getShipmentsByToAgencyLast100(
178
178
  }
179
179
  }
180
180
  `;
181
- exports.getLotsByNameStringQuery = `
182
- query getLots($name: String, $entity_id: Int){
183
- lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {
181
+ exports.getShipmentsByToAgencyLast100StringQuery = getShipmentsByToAgencyLast100StringQuery;
182
+ const getLotsByNameStringQuery = (name, entity_id) => `
183
+ query getLots {
184
+ lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
184
185
  id
185
186
  name
186
187
  description
187
188
  }
188
189
  }
189
190
  `;
190
- exports.getLotStocksByAgencyIdStringQuery = `
191
- query getLotStocksByAgencyId($agency_id: Int){
191
+ exports.getLotsByNameStringQuery = getLotsByNameStringQuery;
192
+ const getLotStocksByAgencyIdStringQuery = (agency_id) => `
193
+ query getLotStocksByAgencyId {
192
194
  lot_stocks (
193
195
  order_by: { id: desc },
194
- where: { agency_id: { _eq: $agency_id }}
196
+ where: { agency_id: { _eq: ${agency_id} } }
195
197
  ){
196
198
  id
197
199
  available
@@ -204,7 +206,8 @@ query getLotStocksByAgencyId($agency_id: Int){
204
206
  }
205
207
  }
206
208
  `;
207
- const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
209
+ exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
210
+ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
208
211
  const conditions = [];
209
212
  if (config.agencyId) {
210
213
  conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
@@ -236,8 +239,8 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
236
239
  }
237
240
  if (!config.id_number) {
238
241
  conditions.push(config.betweenIssueDate
239
- ? "issue_date: { _gte: $startDate, _lte: $endDate }"
240
- : "created_at: { _gte: $startDate, _lte: $endDate }");
242
+ ? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
243
+ : `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
241
244
  }
242
245
  if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
243
246
  conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
@@ -249,12 +252,6 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
249
252
  const whereClause = conditions.length
250
253
  ? `where: { ${conditions.join(", ")} }`
251
254
  : "";
252
- const dateVariables = config.id_number
253
- ? ""
254
- : `(
255
- $startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
256
- $endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
257
- )`;
258
255
  const lotStocksFragment = config.withLotStocks
259
256
  ? `
260
257
  lot_stocks {
@@ -307,7 +304,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
307
304
  }`
308
305
  : "";
309
306
  return `
310
- query getPurchaseOrdersBetweenDates ${dateVariables} {
307
+ query getPurchaseOrdersBetweenDates {
311
308
  purchase_orders (
312
309
  order_by: { id: desc },
313
310
  ${whereClause}
@@ -363,19 +360,22 @@ query getAgencies {
363
360
  }
364
361
  }
365
362
  `;
366
- exports.getWebAppRowStringQuery = `
367
- query getWebAppRow($id: Int){
368
- webapp_rows(where: {id: {_eq: $id}}) {
363
+ const getWebAppRowStringQuery = (id) => `
364
+ query getWebAppRow {
365
+ webapp_rows(where: {id: {_eq: ${id}}}) {
366
+ id
369
367
  data
368
+ created_at
370
369
  }
371
370
  }
372
371
  `;
373
- exports.getWebAppRowsByWebAppTableIdStringQuery = `
374
- query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
372
+ exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
373
+ const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
374
+ query getWebAppRowsByWebAppTableId {
375
375
  webapp_rows (
376
376
  where: {
377
377
  webapp_table_id: {
378
- _eq: $webapp_table_id
378
+ _eq: ${webapp_table_id}
379
379
  }
380
380
  },
381
381
  order_by: {
@@ -388,9 +388,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
388
388
  }
389
389
  }
390
390
  `;
391
- exports.getPayeeCategoryByIdStringQuery = `
392
- query getPayeeCategoryById ($id: Int) {
393
- payee_categories (where: {id: {_eq: $id }}) {
391
+ exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
392
+ const getPayeeCategoryByIdStringQuery = (id) => `
393
+ query getPayeeCategoryById {
394
+ payee_categories (where: {id: {_eq: ${id} }}) {
394
395
  payees (order_by: { id: desc }) {
395
396
  id
396
397
  name
@@ -405,6 +406,7 @@ query getPayeeCategoryById ($id: Int) {
405
406
  }
406
407
  }
407
408
  `;
409
+ exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
408
410
  const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
409
411
  query getPayeeCategoriesByNotesMatch {
410
412
  payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
@@ -467,9 +469,9 @@ query getClientCategories {
467
469
  }
468
470
  }
469
471
  `;
470
- exports.getPayeeByIdStringQuery = `
471
- query getPayeeById ($id: Int) {
472
- payees (where: {id: {_eq: $id }}) {
472
+ const getPayeeByIdStringQuery = (id) => `
473
+ query getPayeeById {
474
+ payees (where: {id: {_eq: ${id} }}) {
473
475
  id
474
476
  name
475
477
  id_number
@@ -481,9 +483,10 @@ query getPayeeById ($id: Int) {
481
483
  }
482
484
  }
483
485
  `;
484
- exports.getSuperCategoryByIdStringQuery = `
485
- query getSuperCategoryById ($id: bigint) {
486
- item_super_categories (where: {id: {_eq: $id }}) {
486
+ exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
487
+ const getSuperCategoryByIdStringQuery = (id) => `
488
+ query getSuperCategoryById {
489
+ item_super_categories (where: {id: {_eq: ${id} }}) {
487
490
  item_categories {
488
491
  id
489
492
  name
@@ -493,9 +496,10 @@ query getSuperCategoryById ($id: bigint) {
493
496
  }
494
497
  }
495
498
  `;
496
- exports.getItemCategoryByIdStringQuery = `
497
- query getItemCategoryById ($id: Int) {
498
- item_categories (where: {id: {_eq: $id }}) {
499
+ exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
500
+ const getItemCategoryByIdStringQuery = (id) => `
501
+ query getItemCategoryById {
502
+ item_categories (where: {id: {_eq: ${id} }}) {
499
503
  id
500
504
  name
501
505
  notes
@@ -503,9 +507,10 @@ query getItemCategoryById ($id: Int) {
503
507
  }
504
508
  }
505
509
  `;
506
- exports.getItemsByCategoryStringQuery = `
507
- query getItemsByCategory ($id: Int) {
508
- item_categories (where: {id: {_eq: $id }}) {
510
+ exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
511
+ const getItemsByCategoryStringQuery = (id) => `
512
+ query getItemsByCategory {
513
+ item_categories (where: {id: {_eq: ${id} }}) {
509
514
  items (where: {active: {_eq: true }}) {
510
515
  id,
511
516
  name,
@@ -516,6 +521,7 @@ query getItemsByCategory ($id: Int) {
516
521
  }
517
522
  }
518
523
  `;
524
+ exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
519
525
  exports.getItemsStringQuery = `
520
526
  query getItems {
521
527
  items (where: {active: {_eq: true }}) {
@@ -525,9 +531,9 @@ query getItems {
525
531
  }
526
532
  }
527
533
  `;
528
- exports.getItemsBySuperCategoryStringQuery = `
529
- query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
530
- item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
534
+ const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
535
+ query getItemsBySuperCategory {
536
+ item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
531
537
  item_categories {
532
538
  items (where: {active: {_eq: true }}) {
533
539
  id,
@@ -538,7 +544,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
538
544
  measurement_unit,
539
545
  description
540
546
  product_type
541
- stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
547
+ stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
542
548
  available
543
549
  id
544
550
  incoming
@@ -549,9 +555,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
549
555
  }
550
556
  }
551
557
  `;
552
- exports.getConsolidatesBetweenDatesStringQuery = `
553
- query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
554
- consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {
558
+ exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
559
+ const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
560
+ query getConsolidatesBetweenDates {
561
+ consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
555
562
  id
556
563
  id_number
557
564
  created_at
@@ -563,9 +570,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
563
570
  }
564
571
  }
565
572
  `;
566
- exports.getEmployeeProfileStringQuery = `
567
- query getEmployeeProfile ($id: Int) {
568
- employees(where: {id: {_eq: $id}}) {
573
+ exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
574
+ const getEmployeeProfileStringQuery = (id) => `
575
+ query getEmployeeProfile {
576
+ employees(where: {id: {_eq: ${id}}}) {
569
577
  agency_id
570
578
  email
571
579
  entity_id
@@ -581,9 +589,10 @@ query getEmployeeProfile ($id: Int) {
581
589
  }
582
590
  }
583
591
  `;
584
- exports.getEmployeesByAgencyIdStringQuery = `
585
- query getEmployeesByAgencyId ($id: Int) {
586
- employees(where: {agency_id: {_eq: $id}}) {
592
+ exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
593
+ const getEmployeesByAgencyIdStringQuery = (id) => `
594
+ query getEmployeesByAgencyId {
595
+ employees(where: {agency_id: {_eq: ${id}}}) {
587
596
  name
588
597
  id
589
598
  user_id
@@ -597,9 +606,10 @@ query getEmployeesByAgencyId ($id: Int) {
597
606
  }
598
607
  }
599
608
  `;
600
- exports.getBundlesByItemCategoryIdStringQuery = `
601
- query getBundlesByItemCategoryId ($id: Int) {
602
- bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {
609
+ exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
610
+ const getBundlesByItemCategoryIdStringQuery = (id) => `
611
+ query getBundlesByItemCategoryId {
612
+ bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
603
613
  id
604
614
  code
605
615
  description
@@ -615,16 +625,18 @@ query getBundlesByItemCategoryId ($id: Int) {
615
625
  }
616
626
  }
617
627
  `;
618
- exports.getBundleByNameStringQuery = `
619
- query getBundleByName ($name: String) {
620
- bundles (where: {name: {_eq: $name }}) {
628
+ exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
629
+ const getBundleByNameStringQuery = (name) => `
630
+ query getBundleByName {
631
+ bundles (where: {name: {_eq: "${name}" }}) {
621
632
  id
622
633
  }
623
634
  }
624
635
  `;
625
- exports.getItemByNameStringQuery = `
626
- query getItemByName ($name: String) {
627
- items (where: {active: {_eq: true }, name: {_eq: $name }}) {
636
+ exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
637
+ const getItemByNameStringQuery = (name) => `
638
+ query getItemByName {
639
+ items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
628
640
  id
629
641
  name
630
642
  stocks_only_integer
@@ -633,6 +645,7 @@ query getItemByName ($name: String) {
633
645
  }
634
646
  }
635
647
  `;
648
+ exports.getItemByNameStringQuery = getItemByNameStringQuery;
636
649
  const getShipmentsStringQuery = (wheres = []) => {
637
650
  const additionalWheres = wheres.join(",");
638
651
  return `query getShipments {
@@ -716,10 +729,10 @@ query getAllForms {
716
729
  }
717
730
  `;
718
731
  exports.getAllFormsStringQuery = getAllFormsStringQuery;
719
- exports.getFormByNameStringQuery = `
720
- query getFormByName ($name: String) {
732
+ const getFormByNameStringQuery = (name) => `
733
+ query getFormByName {
721
734
  settings_forms (
722
- where: {name: {_eq: $name }},
735
+ where: {name: {_eq: "${name}" }},
723
736
  order_by: {zid: desc, version: desc}
724
737
  ) {
725
738
  id
@@ -748,6 +761,7 @@ query getFormByName ($name: String) {
748
761
  }
749
762
  }
750
763
  `;
764
+ exports.getFormByNameStringQuery = getFormByNameStringQuery;
751
765
  exports.getFormsStringQuery = `
752
766
  query getForms {
753
767
  settings_forms (
@@ -779,12 +793,12 @@ query getForms {
779
793
  }
780
794
  }
781
795
  `;
782
- const getFormsByDocumentTypeStringQuery = (filters = {}) => `
783
- query getFormsByDocumentType ($document_type: String) {
796
+ const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
797
+ query getFormsByDocumentType {
784
798
  settings_forms (
785
799
  where: {
786
800
  ${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
787
- document_type: {_eq: $document_type}
801
+ document_type: {_eq: "${document_type}"}
788
802
  },
789
803
  order_by: {zid: desc, version: desc}
790
804
  ) {
@@ -821,8 +835,8 @@ query getFormsByDocumentType ($document_type: String) {
821
835
  }
822
836
  `;
823
837
  exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
824
- const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
825
- query getMyCaseFormSubmissions ($responsible_id: Int) {
838
+ const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
839
+ query getMyCaseFormSubmissions {
826
840
  submission_cases (
827
841
  limit: 500,
828
842
  where: {
@@ -834,7 +848,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
834
848
  },
835
849
  case: {
836
850
  ${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
837
- responsible_id: {_eq: $responsible_id}
851
+ responsible_id: {_eq: ${responsible_id}}
838
852
  }
839
853
  },
840
854
  order_by: {id: desc})
@@ -893,9 +907,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
893
907
  }
894
908
  `;
895
909
  exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
896
- exports.getFormSubmissionByIdStringQuery = `
897
- query getFormSubmissionById ($formId: bigint) {
898
- settings_form_submissions (where: {id: { _eq: $formId }}) {
910
+ const getFormSubmissionByIdStringQuery = (formId) => `
911
+ query getFormSubmissionById {
912
+ settings_form_submissions (where: {id: { _eq: ${formId} }}) {
899
913
  id
900
914
  zid
901
915
  reference
@@ -927,11 +941,10 @@ query getFormSubmissionById ($formId: bigint) {
927
941
  }
928
942
  }
929
943
  `;
930
- const getInvoiceFormSubmissionsByAgencyIdStringQuery = (filters) => {
944
+ exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
945
+ const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
931
946
  return `
932
- query getInvoiceFormSubmissionsByAgencyId (
933
- $agency_id: Int
934
- ) {
947
+ query getInvoiceFormSubmissionsByAgencyId {
935
948
  submission_invoices(
936
949
  where: {
937
950
  settings_form_submission: {
@@ -949,7 +962,7 @@ query getInvoiceFormSubmissionsByAgencyId (
949
962
  ? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
950
963
  : ""}
951
964
  invoice: {
952
- agency_id: {_eq: $agency_id},
965
+ agency_id: {_eq: ${agency_id}},
953
966
  ${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
954
967
  ${filters?.payee_id_number_search
955
968
  ? `payee: {
@@ -1043,11 +1056,11 @@ query getLastInvoiceFormSubmission {
1043
1056
  }
1044
1057
  `;
1045
1058
  exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
1046
- const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
1047
- query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
1059
+ const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
1060
+ query getInvoiceFormSubmissionsByInvoiceId {
1048
1061
  submission_invoices(
1049
1062
  where: {
1050
- invoice_id: {_eq: $invoice_id},
1063
+ invoice_id: {_eq: ${invoice_id}},
1051
1064
  settings_form_submission: {
1052
1065
  ${filters?.formZid
1053
1066
  ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
@@ -1207,9 +1220,9 @@ const getPaymentMethodsStringQuery = (config) => {
1207
1220
  `;
1208
1221
  };
1209
1222
  exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
1210
- exports.getPaymentTermByIdStringQuery = `
1211
- query getPaymentTermById ($id: Int) {
1212
- payment_terms (where: {id: {_eq: $id }}) {
1223
+ const getPaymentTermByIdStringQuery = (id) => `
1224
+ query getPaymentTermById {
1225
+ payment_terms (where: {id: {_eq: ${id} }}) {
1213
1226
  active
1214
1227
  id
1215
1228
  memo
@@ -1222,9 +1235,10 @@ query getPaymentTermById ($id: Int) {
1222
1235
  }
1223
1236
  }
1224
1237
  `;
1225
- exports.getInvoicesByAgencyIdStringQuery = `
1226
- query getInvoicesByAgencyId($id: Int) {
1227
- invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {
1238
+ exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
1239
+ const getInvoicesByAgencyIdStringQuery = (id) => `
1240
+ query getInvoicesByAgencyId {
1241
+ invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
1228
1242
  id
1229
1243
  zid
1230
1244
  id_number
@@ -1269,11 +1283,12 @@ query getInvoicesByAgencyId($id: Int) {
1269
1283
  }
1270
1284
  }
1271
1285
  `;
1272
- const getCasesByResponsibleIdStringQuery = (wheres = []) => {
1286
+ exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
1287
+ const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
1273
1288
  const additionalWheres = wheres.join(",");
1274
1289
  return `
1275
- query getCasesByResponsibleId($responsible_id: Int) {
1276
- cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1290
+ query getCasesByResponsibleId {
1291
+ cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1277
1292
  id
1278
1293
  id_number
1279
1294
  serial_id
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = exports.getShipmentsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = 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.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsByToAgencyLast100StringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
4
- exports.getLast100ReceptionsStringQuery = `
5
- query getLast100Receptions($agencyId: Int) @cached {
6
- purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {
4
+ const getLast100ReceptionsStringQuery = (agency_id) => `
5
+ query getLast100Receptions {
6
+ purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
7
7
  id
8
8
  created_at
9
9
  due
@@ -32,9 +32,10 @@ query getLast100Receptions($agencyId: Int) @cached {
32
32
  }
33
33
  }
34
34
  `;
35
- exports.getPurchaseOrderByIdNumberStringQuery = `
36
- query getPurchaseOrderByIdNumber($id_number: String) @cached {
37
- purchase_orders(where: {id_number: {_eq: $id_number}}) {
35
+ exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
36
+ const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
37
+ query getPurchaseOrderByIdNumber {
38
+ purchase_orders(where: {id_number: {_eq: "${id_number}"}}) {
38
39
  id
39
40
  created_at
40
41
  due
@@ -76,9 +77,10 @@ query getPurchaseOrderByIdNumber($id_number: String) @cached {
76
77
  }
77
78
  }
78
79
  `;
79
- const getPurchaseOrderStringQuery = (config = { withLotStocks: false }) => `
80
- query getPurchaseOrder($id: Int) @cached {
81
- purchase_orders(where: {id: {_eq: $id}}) {
80
+ exports.getPurchaseOrderByIdNumberStringQuery = getPurchaseOrderByIdNumberStringQuery;
81
+ const getPurchaseOrderStringQuery = (id, config = { withLotStocks: false }) => `
82
+ query getPurchaseOrder($id: bigint) @cached {
83
+ purchase_orders(where: {id: {_eq: ${id}}}) {
82
84
  id
83
85
  agency_id
84
86
  entity_id
@@ -147,11 +149,9 @@ query getPurchaseOrder($id: Int) @cached {
147
149
  }
148
150
  `;
149
151
  exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
150
- exports.getShipmentsByToAgencyLast100StringQuery = `
151
- query getShipmentsByToAgencyLast100(
152
- $agency_to_id: Int
153
- ){
154
- shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
152
+ const getShipmentsByToAgencyLast100StringQuery = (agency_to_id) => `
153
+ query getShipmentsByToAgencyLast100 {
154
+ shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: ${agency_to_id}}}) {
155
155
  id
156
156
  zid
157
157
  id_number
@@ -178,20 +178,22 @@ query getShipmentsByToAgencyLast100(
178
178
  }
179
179
  }
180
180
  `;
181
- exports.getLotsByNameStringQuery = `
182
- query getLots($name: String, $entity_id: Int){
183
- lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {
181
+ exports.getShipmentsByToAgencyLast100StringQuery = getShipmentsByToAgencyLast100StringQuery;
182
+ const getLotsByNameStringQuery = (name, entity_id) => `
183
+ query getLots {
184
+ lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
184
185
  id
185
186
  name
186
187
  description
187
188
  }
188
189
  }
189
190
  `;
190
- exports.getLotStocksByAgencyIdStringQuery = `
191
- query getLotStocksByAgencyId($agency_id: Int){
191
+ exports.getLotsByNameStringQuery = getLotsByNameStringQuery;
192
+ const getLotStocksByAgencyIdStringQuery = (agency_id) => `
193
+ query getLotStocksByAgencyId {
192
194
  lot_stocks (
193
195
  order_by: { id: desc },
194
- where: { agency_id: { _eq: $agency_id }}
196
+ where: { agency_id: { _eq: ${agency_id} } }
195
197
  ){
196
198
  id
197
199
  available
@@ -204,7 +206,8 @@ query getLotStocksByAgencyId($agency_id: Int){
204
206
  }
205
207
  }
206
208
  `;
207
- const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
209
+ exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
210
+ const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
208
211
  const conditions = [];
209
212
  if (config.agencyId) {
210
213
  conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
@@ -236,8 +239,8 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
236
239
  }
237
240
  if (!config.id_number) {
238
241
  conditions.push(config.betweenIssueDate
239
- ? "issue_date: { _gte: $startDate, _lte: $endDate }"
240
- : "created_at: { _gte: $startDate, _lte: $endDate }");
242
+ ? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
243
+ : `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
241
244
  }
242
245
  if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
243
246
  conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
@@ -249,12 +252,6 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
249
252
  const whereClause = conditions.length
250
253
  ? `where: { ${conditions.join(", ")} }`
251
254
  : "";
252
- const dateVariables = config.id_number
253
- ? ""
254
- : `(
255
- $startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
256
- $endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
257
- )`;
258
255
  const lotStocksFragment = config.withLotStocks
259
256
  ? `
260
257
  lot_stocks {
@@ -307,7 +304,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
307
304
  }`
308
305
  : "";
309
306
  return `
310
- query getPurchaseOrdersBetweenDates ${dateVariables} {
307
+ query getPurchaseOrdersBetweenDates {
311
308
  purchase_orders (
312
309
  order_by: { id: desc },
313
310
  ${whereClause}
@@ -363,19 +360,22 @@ query getAgencies {
363
360
  }
364
361
  }
365
362
  `;
366
- exports.getWebAppRowStringQuery = `
367
- query getWebAppRow($id: Int){
368
- webapp_rows(where: {id: {_eq: $id}}) {
363
+ const getWebAppRowStringQuery = (id) => `
364
+ query getWebAppRow {
365
+ webapp_rows(where: {id: {_eq: ${id}}}) {
366
+ id
369
367
  data
368
+ created_at
370
369
  }
371
370
  }
372
371
  `;
373
- exports.getWebAppRowsByWebAppTableIdStringQuery = `
374
- query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
372
+ exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
373
+ const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
374
+ query getWebAppRowsByWebAppTableId {
375
375
  webapp_rows (
376
376
  where: {
377
377
  webapp_table_id: {
378
- _eq: $webapp_table_id
378
+ _eq: ${webapp_table_id}
379
379
  }
380
380
  },
381
381
  order_by: {
@@ -388,9 +388,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
388
388
  }
389
389
  }
390
390
  `;
391
- exports.getPayeeCategoryByIdStringQuery = `
392
- query getPayeeCategoryById ($id: Int) {
393
- payee_categories (where: {id: {_eq: $id }}) {
391
+ exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
392
+ const getPayeeCategoryByIdStringQuery = (id) => `
393
+ query getPayeeCategoryById {
394
+ payee_categories (where: {id: {_eq: ${id} }}) {
394
395
  payees (order_by: { id: desc }) {
395
396
  id
396
397
  name
@@ -405,6 +406,7 @@ query getPayeeCategoryById ($id: Int) {
405
406
  }
406
407
  }
407
408
  `;
409
+ exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
408
410
  const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
409
411
  query getPayeeCategoriesByNotesMatch {
410
412
  payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
@@ -467,9 +469,9 @@ query getClientCategories {
467
469
  }
468
470
  }
469
471
  `;
470
- exports.getPayeeByIdStringQuery = `
471
- query getPayeeById ($id: Int) {
472
- payees (where: {id: {_eq: $id }}) {
472
+ const getPayeeByIdStringQuery = (id) => `
473
+ query getPayeeById {
474
+ payees (where: {id: {_eq: ${id} }}) {
473
475
  id
474
476
  name
475
477
  id_number
@@ -481,9 +483,10 @@ query getPayeeById ($id: Int) {
481
483
  }
482
484
  }
483
485
  `;
484
- exports.getSuperCategoryByIdStringQuery = `
485
- query getSuperCategoryById ($id: bigint) {
486
- item_super_categories (where: {id: {_eq: $id }}) {
486
+ exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
487
+ const getSuperCategoryByIdStringQuery = (id) => `
488
+ query getSuperCategoryById {
489
+ item_super_categories (where: {id: {_eq: ${id} }}) {
487
490
  item_categories {
488
491
  id
489
492
  name
@@ -493,9 +496,10 @@ query getSuperCategoryById ($id: bigint) {
493
496
  }
494
497
  }
495
498
  `;
496
- exports.getItemCategoryByIdStringQuery = `
497
- query getItemCategoryById ($id: Int) {
498
- item_categories (where: {id: {_eq: $id }}) {
499
+ exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
500
+ const getItemCategoryByIdStringQuery = (id) => `
501
+ query getItemCategoryById {
502
+ item_categories (where: {id: {_eq: ${id} }}) {
499
503
  id
500
504
  name
501
505
  notes
@@ -503,9 +507,10 @@ query getItemCategoryById ($id: Int) {
503
507
  }
504
508
  }
505
509
  `;
506
- exports.getItemsByCategoryStringQuery = `
507
- query getItemsByCategory ($id: Int) {
508
- item_categories (where: {id: {_eq: $id }}) {
510
+ exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
511
+ const getItemsByCategoryStringQuery = (id) => `
512
+ query getItemsByCategory {
513
+ item_categories (where: {id: {_eq: ${id} }}) {
509
514
  items (where: {active: {_eq: true }}) {
510
515
  id,
511
516
  name,
@@ -516,6 +521,7 @@ query getItemsByCategory ($id: Int) {
516
521
  }
517
522
  }
518
523
  `;
524
+ exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
519
525
  exports.getItemsStringQuery = `
520
526
  query getItems {
521
527
  items (where: {active: {_eq: true }}) {
@@ -525,9 +531,9 @@ query getItems {
525
531
  }
526
532
  }
527
533
  `;
528
- exports.getItemsBySuperCategoryStringQuery = `
529
- query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
530
- item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
534
+ const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
535
+ query getItemsBySuperCategory {
536
+ item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
531
537
  item_categories {
532
538
  items (where: {active: {_eq: true }}) {
533
539
  id,
@@ -538,7 +544,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
538
544
  measurement_unit,
539
545
  description
540
546
  product_type
541
- stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
547
+ stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
542
548
  available
543
549
  id
544
550
  incoming
@@ -549,9 +555,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
549
555
  }
550
556
  }
551
557
  `;
552
- exports.getConsolidatesBetweenDatesStringQuery = `
553
- query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
554
- consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {
558
+ exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
559
+ const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
560
+ query getConsolidatesBetweenDates {
561
+ consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
555
562
  id
556
563
  id_number
557
564
  created_at
@@ -563,9 +570,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
563
570
  }
564
571
  }
565
572
  `;
566
- exports.getEmployeeProfileStringQuery = `
567
- query getEmployeeProfile ($id: Int) {
568
- employees(where: {id: {_eq: $id}}) {
573
+ exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
574
+ const getEmployeeProfileStringQuery = (id) => `
575
+ query getEmployeeProfile {
576
+ employees(where: {id: {_eq: ${id}}}) {
569
577
  agency_id
570
578
  email
571
579
  entity_id
@@ -581,9 +589,10 @@ query getEmployeeProfile ($id: Int) {
581
589
  }
582
590
  }
583
591
  `;
584
- exports.getEmployeesByAgencyIdStringQuery = `
585
- query getEmployeesByAgencyId ($id: Int) {
586
- employees(where: {agency_id: {_eq: $id}}) {
592
+ exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
593
+ const getEmployeesByAgencyIdStringQuery = (id) => `
594
+ query getEmployeesByAgencyId {
595
+ employees(where: {agency_id: {_eq: ${id}}}) {
587
596
  name
588
597
  id
589
598
  user_id
@@ -597,9 +606,10 @@ query getEmployeesByAgencyId ($id: Int) {
597
606
  }
598
607
  }
599
608
  `;
600
- exports.getBundlesByItemCategoryIdStringQuery = `
601
- query getBundlesByItemCategoryId ($id: Int) {
602
- bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {
609
+ exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
610
+ const getBundlesByItemCategoryIdStringQuery = (id) => `
611
+ query getBundlesByItemCategoryId {
612
+ bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
603
613
  id
604
614
  code
605
615
  description
@@ -615,16 +625,18 @@ query getBundlesByItemCategoryId ($id: Int) {
615
625
  }
616
626
  }
617
627
  `;
618
- exports.getBundleByNameStringQuery = `
619
- query getBundleByName ($name: String) {
620
- bundles (where: {name: {_eq: $name }}) {
628
+ exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
629
+ const getBundleByNameStringQuery = (name) => `
630
+ query getBundleByName {
631
+ bundles (where: {name: {_eq: "${name}" }}) {
621
632
  id
622
633
  }
623
634
  }
624
635
  `;
625
- exports.getItemByNameStringQuery = `
626
- query getItemByName ($name: String) {
627
- items (where: {active: {_eq: true }, name: {_eq: $name }}) {
636
+ exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
637
+ const getItemByNameStringQuery = (name) => `
638
+ query getItemByName {
639
+ items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
628
640
  id
629
641
  name
630
642
  stocks_only_integer
@@ -633,6 +645,7 @@ query getItemByName ($name: String) {
633
645
  }
634
646
  }
635
647
  `;
648
+ exports.getItemByNameStringQuery = getItemByNameStringQuery;
636
649
  const getShipmentsStringQuery = (wheres = []) => {
637
650
  const additionalWheres = wheres.join(",");
638
651
  return `query getShipments {
@@ -716,10 +729,10 @@ query getAllForms {
716
729
  }
717
730
  `;
718
731
  exports.getAllFormsStringQuery = getAllFormsStringQuery;
719
- exports.getFormByNameStringQuery = `
720
- query getFormByName ($name: String) {
732
+ const getFormByNameStringQuery = (name) => `
733
+ query getFormByName {
721
734
  settings_forms (
722
- where: {name: {_eq: $name }},
735
+ where: {name: {_eq: "${name}" }},
723
736
  order_by: {zid: desc, version: desc}
724
737
  ) {
725
738
  id
@@ -748,6 +761,7 @@ query getFormByName ($name: String) {
748
761
  }
749
762
  }
750
763
  `;
764
+ exports.getFormByNameStringQuery = getFormByNameStringQuery;
751
765
  exports.getFormsStringQuery = `
752
766
  query getForms {
753
767
  settings_forms (
@@ -779,12 +793,12 @@ query getForms {
779
793
  }
780
794
  }
781
795
  `;
782
- const getFormsByDocumentTypeStringQuery = (filters = {}) => `
783
- query getFormsByDocumentType ($document_type: String) {
796
+ const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
797
+ query getFormsByDocumentType {
784
798
  settings_forms (
785
799
  where: {
786
800
  ${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
787
- document_type: {_eq: $document_type}
801
+ document_type: {_eq: "${document_type}"}
788
802
  },
789
803
  order_by: {zid: desc, version: desc}
790
804
  ) {
@@ -821,8 +835,8 @@ query getFormsByDocumentType ($document_type: String) {
821
835
  }
822
836
  `;
823
837
  exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
824
- const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
825
- query getMyCaseFormSubmissions ($responsible_id: Int) {
838
+ const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
839
+ query getMyCaseFormSubmissions {
826
840
  submission_cases (
827
841
  limit: 500,
828
842
  where: {
@@ -834,7 +848,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
834
848
  },
835
849
  case: {
836
850
  ${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
837
- responsible_id: {_eq: $responsible_id}
851
+ responsible_id: {_eq: ${responsible_id}}
838
852
  }
839
853
  },
840
854
  order_by: {id: desc})
@@ -893,9 +907,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
893
907
  }
894
908
  `;
895
909
  exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
896
- exports.getFormSubmissionByIdStringQuery = `
897
- query getFormSubmissionById ($formId: bigint) {
898
- settings_form_submissions (where: {id: { _eq: $formId }}) {
910
+ const getFormSubmissionByIdStringQuery = (formId) => `
911
+ query getFormSubmissionById {
912
+ settings_form_submissions (where: {id: { _eq: ${formId} }}) {
899
913
  id
900
914
  zid
901
915
  reference
@@ -927,11 +941,10 @@ query getFormSubmissionById ($formId: bigint) {
927
941
  }
928
942
  }
929
943
  `;
930
- const getInvoiceFormSubmissionsByAgencyIdStringQuery = (filters) => {
944
+ exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
945
+ const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
931
946
  return `
932
- query getInvoiceFormSubmissionsByAgencyId (
933
- $agency_id: Int
934
- ) {
947
+ query getInvoiceFormSubmissionsByAgencyId {
935
948
  submission_invoices(
936
949
  where: {
937
950
  settings_form_submission: {
@@ -949,7 +962,7 @@ query getInvoiceFormSubmissionsByAgencyId (
949
962
  ? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
950
963
  : ""}
951
964
  invoice: {
952
- agency_id: {_eq: $agency_id},
965
+ agency_id: {_eq: ${agency_id}},
953
966
  ${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
954
967
  ${filters?.payee_id_number_search
955
968
  ? `payee: {
@@ -1043,11 +1056,11 @@ query getLastInvoiceFormSubmission {
1043
1056
  }
1044
1057
  `;
1045
1058
  exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
1046
- const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
1047
- query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
1059
+ const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
1060
+ query getInvoiceFormSubmissionsByInvoiceId {
1048
1061
  submission_invoices(
1049
1062
  where: {
1050
- invoice_id: {_eq: $invoice_id},
1063
+ invoice_id: {_eq: ${invoice_id}},
1051
1064
  settings_form_submission: {
1052
1065
  ${filters?.formZid
1053
1066
  ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
@@ -1207,9 +1220,9 @@ const getPaymentMethodsStringQuery = (config) => {
1207
1220
  `;
1208
1221
  };
1209
1222
  exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
1210
- exports.getPaymentTermByIdStringQuery = `
1211
- query getPaymentTermById ($id: Int) {
1212
- payment_terms (where: {id: {_eq: $id }}) {
1223
+ const getPaymentTermByIdStringQuery = (id) => `
1224
+ query getPaymentTermById {
1225
+ payment_terms (where: {id: {_eq: ${id} }}) {
1213
1226
  active
1214
1227
  id
1215
1228
  memo
@@ -1222,9 +1235,10 @@ query getPaymentTermById ($id: Int) {
1222
1235
  }
1223
1236
  }
1224
1237
  `;
1225
- exports.getInvoicesByAgencyIdStringQuery = `
1226
- query getInvoicesByAgencyId($id: Int) {
1227
- invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {
1238
+ exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
1239
+ const getInvoicesByAgencyIdStringQuery = (id) => `
1240
+ query getInvoicesByAgencyId {
1241
+ invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
1228
1242
  id
1229
1243
  zid
1230
1244
  id_number
@@ -1269,11 +1283,12 @@ query getInvoicesByAgencyId($id: Int) {
1269
1283
  }
1270
1284
  }
1271
1285
  `;
1272
- const getCasesByResponsibleIdStringQuery = (wheres = []) => {
1286
+ exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
1287
+ const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
1273
1288
  const additionalWheres = wheres.join(",");
1274
1289
  return `
1275
- query getCasesByResponsibleId($responsible_id: Int) {
1276
- cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1290
+ query getCasesByResponsibleId {
1291
+ cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1277
1292
  id
1278
1293
  id_number
1279
1294
  serial_id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "1.0.93",
3
+ "version": "1.0.105",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -22,5 +22,5 @@
22
22
  "devDependencies": {
23
23
  "typescript": "^5.1.6"
24
24
  },
25
- "gitHead": "a4e373756557e03f71ada4063312c34945737bb7"
25
+ "gitHead": "57fb17e6d485c1d661432a1517fe8c4e8d354e78"
26
26
  }