@zauru-sdk/graphql 1.0.115 → 1.0.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "1.0.115",
3
+ "version": "1.0.119",
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",
@@ -9,8 +9,7 @@
9
9
  "access": "public"
10
10
  },
11
11
  "scripts": {
12
- "build": "npm run build:cjs && npm run build:esm",
13
- "build:cjs": "tsc -p tsconfig.cjs.json",
12
+ "build": "npm run build:esm",
14
13
  "build:esm": "tsc -p tsconfig.esm.json",
15
14
  "test": "echo \"Error: no test specified\" && exit 1"
16
15
  },
@@ -22,5 +21,5 @@
22
21
  "devDependencies": {
23
22
  "typescript": "^5.1.6"
24
23
  },
25
- "gitHead": "9a49125d2c7974621d59f96389b9e08e3fa68dc9"
24
+ "gitHead": "61a0842f7e502c72e54defddb197fa69aa58f422"
26
25
  }
@@ -1,1339 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- 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
- id
8
- created_at
9
- due
10
- id_number
11
- memo
12
- payee_id
13
- issue_date
14
- discount
15
- other_charges
16
- authorized
17
- received
18
- transport_type
19
- purchase_order_details {
20
- item_id
21
- id
22
- reference
23
- booked_quantity
24
- delivered_quantity
25
- }
26
- lots(where: {active: {_eq: true}}) {
27
- id
28
- name
29
- description
30
- item_id
31
- }
32
- }
33
- }
34
- `;
35
- exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
36
- const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
37
- query getPurchaseOrderByIdNumber {
38
- purchase_orders(where: {id_number: {_eq: "${id_number}"}}) {
39
- id
40
- created_at
41
- due
42
- id_number
43
- memo
44
- payee_id
45
- transport_type
46
- reference
47
- incoterm_destination
48
- issue_date
49
- voided
50
- received
51
- discount
52
- other_charges
53
- webapp_table_rowables {
54
- webapp_rows {
55
- data
56
- }
57
- }
58
- purchase_order_details {
59
- item_id
60
- id
61
- reference
62
- booked_quantity
63
- delivered_quantity
64
- }
65
- lots(where: {active: {_eq: true}}) {
66
- id
67
- description
68
- }
69
- receptions {
70
- id
71
- received
72
- voided
73
- }
74
- shipments {
75
- shipment_id
76
- }
77
- }
78
- }
79
- `;
80
- exports.getPurchaseOrderByIdNumberStringQuery = getPurchaseOrderByIdNumberStringQuery;
81
- const getPurchaseOrderStringQuery = (id, config = { withLotStocks: false }) => `
82
- query getPurchaseOrder($id: bigint) @cached {
83
- purchase_orders(where: {id: {_eq: ${id}}}) {
84
- id
85
- agency_id
86
- entity_id
87
- created_at
88
- due
89
- id_number
90
- memo
91
- payee_id
92
- transport_type
93
- reference
94
- incoterm_destination
95
- issue_date
96
- voided
97
- received
98
- discount
99
- delivery_date
100
- other_charges
101
- webapp_table_rowables {
102
- webapp_rows {
103
- data
104
- }
105
- }
106
- purchase_order_details {
107
- item_id
108
- id
109
- reference
110
- booked_quantity
111
- delivered_quantity
112
- item {
113
- name
114
- }
115
- }
116
- lots(where: {active: {_eq: true}}) {
117
- id
118
- name
119
- description
120
- ${config.withLotStocks
121
- ? `lot_stocks {
122
- id
123
- available
124
- incoming
125
- outgoing
126
- agency_id
127
- }`
128
- : ""}
129
- }
130
- receptions {
131
- id
132
- received
133
- voided
134
- agency_id
135
- entity_id
136
- reception_details {
137
- purchase_order_detail_id
138
- item_id
139
- lot_delivered_quantity
140
- lot_description
141
- lot_expire
142
- lot_name
143
- }
144
- }
145
- shipment_purchase_orders {
146
- shipment_id
147
- }
148
- }
149
- }
150
- `;
151
- exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
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
- id
156
- zid
157
- id_number
158
- reference
159
- needs_transport
160
- payee_id
161
- income
162
- booker_id
163
- agency_from_id
164
- agency_to_id
165
- transporter_id
166
- created_at
167
- movements {
168
- id
169
- booked_quantity
170
- delivered_quantity
171
- reference
172
- lot {
173
- id
174
- name
175
- description
176
- }
177
- }
178
- }
179
- }
180
- `;
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}"}}) {
185
- id
186
- name
187
- description
188
- }
189
- }
190
- `;
191
- exports.getLotsByNameStringQuery = getLotsByNameStringQuery;
192
- const getLotStocksByAgencyIdStringQuery = (agency_id) => `
193
- query getLotStocksByAgencyId {
194
- lot_stocks (
195
- order_by: { id: desc },
196
- where: { agency_id: { _eq: ${agency_id} } }
197
- ){
198
- id
199
- available
200
- lot_id
201
- lot {
202
- id
203
- item_id
204
- expires
205
- }
206
- }
207
- }
208
- `;
209
- exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
210
- const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
211
- const conditions = [];
212
- if (config.agencyId) {
213
- conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
214
- }
215
- if (config.consolidateIdFilter) {
216
- conditions.push("consolidate_id: { _is_null: true }");
217
- }
218
- if (config.id_number) {
219
- conditions.push(`id_number: { _ilike: "%${config.id_number}%" }`);
220
- }
221
- if (config.payeeId || config.payeeCategoryId) {
222
- const payeeConditions = [];
223
- if (config.payeeId) {
224
- payeeConditions.push(`id: { _eq: ${config.payeeId} }`);
225
- }
226
- if (config.payeeCategoryId) {
227
- payeeConditions.push(`payee_category: { id: { _eq: ${config.payeeCategoryId} } }`);
228
- }
229
- conditions.push(`payee: { ${payeeConditions.join(", ")} }`);
230
- }
231
- if (config.itemId) {
232
- conditions.push(`purchase_order_details: { item_id: { _eq: ${config.itemId} } }`);
233
- }
234
- if (config.lotItemIdExclusion) {
235
- conditions.push(`lots: { item_id: { _neq: ${config.lotItemIdExclusion} } }`);
236
- }
237
- if (config.poDetailTagId) {
238
- conditions.push(`purchase_order_details: { tag_id: { _eq: ${config.poDetailTagId} } }`);
239
- }
240
- if (!config.id_number) {
241
- conditions.push(config.betweenIssueDate
242
- ? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
243
- : `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
244
- }
245
- if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
246
- conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
247
- }
248
- if (config.excludePayeeCategoryIds &&
249
- config.excludePayeeCategoryIds.length > 0) {
250
- conditions.push(`payee: { payee_category: { id: { _nin: [${config.excludePayeeCategoryIds.join(",")}] } } }`);
251
- }
252
- if (!!config.discountComparisonOperator && !!config.discount) {
253
- conditions.push(`discount: { ${config.discountComparisonOperator}: ${config.discount} }`);
254
- }
255
- const whereClause = conditions.length
256
- ? `where: { ${conditions.join(", ")} }`
257
- : "";
258
- const lotStocksFragment = config.withLotStocks
259
- ? `
260
- lot_stocks {
261
- id
262
- available
263
- incoming
264
- outgoing
265
- agency_id
266
- }
267
- `
268
- : "";
269
- const purchaseOrderDetails = config.withPODetails
270
- ? `purchase_order_details {
271
- item_id
272
- id
273
- reference
274
- booked_quantity
275
- delivered_quantity
276
- }`
277
- : "";
278
- const lots = config.withLots
279
- ? `lots {
280
- id
281
- name
282
- description
283
- ${lotStocksFragment}
284
- }`
285
- : "";
286
- const webAppRows = config.withWebAppRows
287
- ? `webapp_table_rowables {
288
- webapp_rows {
289
- data
290
- }
291
- }`
292
- : "";
293
- const shipmentPurchase = config.withShipmentPurchaseOrders
294
- ? `shipment_purchase_orders {
295
- shipment {
296
- id
297
- zid
298
- id_number
299
- reference
300
- needs_transport
301
- payee_id
302
- income
303
- booker_id
304
- agency_from_id
305
- agency_to_id
306
- }
307
- }`
308
- : "";
309
- return `
310
- query getPurchaseOrdersBetweenDates {
311
- purchase_orders (
312
- order_by: { id: desc },
313
- ${whereClause}
314
- ) {
315
- id
316
- created_at
317
- due
318
- id_number
319
- memo
320
- payee_id
321
- issue_date
322
- agency_id
323
- discount
324
- other_charges
325
- consolidate_id
326
- ${purchaseOrderDetails}
327
- ${lots}
328
- ${webAppRows}
329
- ${shipmentPurchase}
330
- }
331
- }
332
- `;
333
- };
334
- exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
335
- exports.getPayeesStringQuery = `
336
- query getPayees {
337
- payees {
338
- id
339
- id_number
340
- name
341
- tin
342
- vendor
343
- address_line_1
344
- }
345
- }
346
- `;
347
- exports.getProvidersStringQuery = `
348
- query getProviders {
349
- payees (where: {vendor: {_eq: true}}) {
350
- id
351
- id_number
352
- name
353
- tin
354
- address_line_1
355
- }
356
- }
357
- `;
358
- exports.getAgenciesStringQuery = `
359
- query getAgencies {
360
- agencies {
361
- id
362
- name
363
- }
364
- }
365
- `;
366
- const getWebAppRowStringQuery = (id) => `
367
- query getWebAppRow {
368
- webapp_rows(where: {id: {_eq: ${id}}}) {
369
- id
370
- data
371
- created_at
372
- }
373
- }
374
- `;
375
- exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
376
- const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
377
- query getWebAppRowsByWebAppTableId {
378
- webapp_rows (
379
- where: {
380
- webapp_table_id: {
381
- _eq: ${webapp_table_id}
382
- }
383
- },
384
- order_by: {
385
- id: desc
386
- }
387
- ) {
388
- id
389
- data
390
- created_at
391
- }
392
- }
393
- `;
394
- exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
395
- const getPayeeCategoryByIdStringQuery = (id) => `
396
- query getPayeeCategoryById {
397
- payee_categories (where: {id: {_eq: ${id} }}) {
398
- payees (order_by: { id: desc }) {
399
- id
400
- name
401
- id_number
402
- email
403
- phone
404
- tin
405
- active
406
- address_line_1
407
- vendor
408
- }
409
- }
410
- }
411
- `;
412
- exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
413
- const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
414
- query getPayeeCategoriesByNotesMatch {
415
- payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
416
- id
417
- name
418
- notes
419
- payees_count
420
- price_list_id
421
- price_list {
422
- id
423
- name
424
- }
425
- payees(order_by: {id: desc}) {
426
- id
427
- name
428
- id_number
429
- email
430
- phone
431
- tin
432
- active
433
- payee_category_id
434
- allowed_payment_terms {
435
- payment_term_id
436
- }
437
- }
438
- }
439
- }
440
- `;
441
- exports.getPayeeCategoriesByNotesMatchStringQuery = getPayeeCategoriesByNotesMatchStringQuery;
442
- exports.getPayeeCategoriesStringQuery = `
443
- query getPayeeCategories {
444
- payee_categories {
445
- id
446
- name
447
- notes
448
- payees_count
449
- price_list_id
450
- }
451
- }
452
- `;
453
- exports.getProviderCategoriesStringQuery = `
454
- query getProviderCategories {
455
- payee_categories (where: {vendor: {_eq: true}}) {
456
- id
457
- name
458
- notes
459
- payees_count
460
- price_list_id
461
- }
462
- }
463
- `;
464
- exports.getClientCategoriesStringQuery = `
465
- query getClientCategories {
466
- payee_categories (where: {vendor: {_eq: false}}) {
467
- id
468
- name
469
- notes
470
- payees_count
471
- price_list_id
472
- }
473
- }
474
- `;
475
- const getPayeeByIdStringQuery = (id) => `
476
- query getPayeeById {
477
- payees (where: {id: {_eq: ${id} }}) {
478
- id
479
- name
480
- id_number
481
- email
482
- phone
483
- tin
484
- active
485
- address_line_1
486
- }
487
- }
488
- `;
489
- exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
490
- const getSuperCategoryByIdStringQuery = (id) => `
491
- query getSuperCategoryById {
492
- item_super_categories (where: {id: {_eq: ${id} }}) {
493
- item_categories {
494
- id
495
- name
496
- notes
497
- items_count
498
- }
499
- }
500
- }
501
- `;
502
- exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
503
- const getItemCategoryByIdStringQuery = (id) => `
504
- query getItemCategoryById {
505
- item_categories (where: {id: {_eq: ${id} }}) {
506
- id
507
- name
508
- notes
509
- items_count
510
- }
511
- }
512
- `;
513
- exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
514
- const getItemsByCategoryStringQuery = (id) => `
515
- query getItemsByCategory {
516
- item_categories (where: {id: {_eq: ${id} }}) {
517
- items (where: {active: {_eq: true }}) {
518
- id,
519
- name,
520
- stocks_only_integer,
521
- code
522
- product_type
523
- }
524
- }
525
- }
526
- `;
527
- exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
528
- exports.getItemsStringQuery = `
529
- query getItems {
530
- items (where: {active: {_eq: true }}) {
531
- id,
532
- name,
533
- code
534
- }
535
- }
536
- `;
537
- const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
538
- query getItemsBySuperCategory {
539
- item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
540
- item_categories {
541
- items (where: {active: {_eq: true }}) {
542
- id,
543
- name,
544
- stocks_only_integer,
545
- code,
546
- item_category_id,
547
- measurement_unit,
548
- description
549
- product_type
550
- stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
551
- available
552
- id
553
- incoming
554
- outgoing
555
- }
556
- }
557
- }
558
- }
559
- }
560
- `;
561
- exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
562
- const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
563
- query getConsolidatesBetweenDates {
564
- consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
565
- id
566
- id_number
567
- created_at
568
- name
569
- purchase_orders {
570
- id
571
- due
572
- }
573
- }
574
- }
575
- `;
576
- exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
577
- const getEmployeeProfileStringQuery = (id) => `
578
- query getEmployeeProfile {
579
- employees(where: {id: {_eq: ${id}}}) {
580
- agency_id
581
- email
582
- entity_id
583
- id
584
- name
585
- user_id
586
- seller
587
- active
588
- accountant
589
- inventory_controller
590
- buyer
591
- support_agent
592
- }
593
- }
594
- `;
595
- exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
596
- const getEmployeesByAgencyIdStringQuery = (id) => `
597
- query getEmployeesByAgencyId {
598
- employees(where: {agency_id: {_eq: ${id}}}) {
599
- name
600
- id
601
- user_id
602
- email
603
- seller
604
- active
605
- accountant
606
- inventory_controller
607
- buyer
608
- support_agent
609
- }
610
- }
611
- `;
612
- exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
613
- const getBundlesByItemCategoryIdStringQuery = (id) => `
614
- query getBundlesByItemCategoryId {
615
- bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
616
- id
617
- code
618
- description
619
- name
620
- updated_at
621
- image5
622
- bundle_details_count
623
- bundle_details {
624
- id
625
- item_id
626
- quantity
627
- }
628
- }
629
- }
630
- `;
631
- exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
632
- const getBundleByNameStringQuery = (name) => `
633
- query getBundleByName {
634
- bundles (where: {name: {_eq: "${name}" }}) {
635
- id
636
- }
637
- }
638
- `;
639
- exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
640
- const getItemByNameStringQuery = (name) => `
641
- query getItemByName {
642
- items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
643
- id
644
- name
645
- stocks_only_integer
646
- code
647
- product_type
648
- }
649
- }
650
- `;
651
- exports.getItemByNameStringQuery = getItemByNameStringQuery;
652
- const getShipmentsStringQuery = (wheres = []) => {
653
- const additionalWheres = wheres.join(",");
654
- return `query getShipments {
655
- shipments (${additionalWheres.length > 0 ? `where: {${additionalWheres}},` : ""} order_by: {id: desc}) {
656
- id
657
- id_number
658
- reference
659
- needs_transport
660
- payee_id
661
- booker_id
662
- shipped
663
- shipper_id
664
- delivered
665
- delivered_at
666
- voided
667
- returned
668
- memo
669
- planned_delivery
670
- }
671
- }
672
- `;
673
- };
674
- exports.getShipmentsStringQuery = getShipmentsStringQuery;
675
- const getAllFormsStringQuery = (config = { withSubmissions: false }) => `
676
- query getAllForms {
677
- settings_forms (
678
- order_by: {zid: desc, version: desc}
679
- ) {
680
- id
681
- zid
682
- name
683
- description
684
- version
685
- active
686
- ${config.withSubmissions
687
- ? `settings_form_submissions {
688
- id
689
- zid
690
- reference
691
- created_at
692
- version
693
- id_number
694
- user_id
695
- settings_form_submission_values {
696
- id
697
- form_field_id
698
- value
699
- settings_form_field {
700
- id
701
- name
702
- print_var_name
703
- field_type
704
- settings_form_field_options {
705
- id
706
- label
707
- position
708
- value
709
- }
710
- }
711
- }
712
- }`
713
- : ""}
714
- settings_form_fields (order_by: {position: asc}) {
715
- id
716
- name
717
- field_type
718
- hint
719
- required
720
- default_value
721
- position
722
- print_var_name
723
- form_id
724
- settings_form_field_options {
725
- id
726
- label
727
- position
728
- value
729
- }
730
- }
731
- }
732
- }
733
- `;
734
- exports.getAllFormsStringQuery = getAllFormsStringQuery;
735
- const getFormByNameStringQuery = (name) => `
736
- query getFormByName {
737
- settings_forms (
738
- where: {name: {_eq: "${name}" }},
739
- order_by: {zid: desc, version: desc}
740
- ) {
741
- id
742
- zid
743
- name
744
- description
745
- version
746
- active
747
- settings_form_fields (order_by: {position: asc}) {
748
- id
749
- name
750
- field_type
751
- hint
752
- required
753
- default_value
754
- position
755
- print_var_name
756
- form_id
757
- settings_form_field_options {
758
- id
759
- label
760
- position
761
- value
762
- }
763
- }
764
- }
765
- }
766
- `;
767
- exports.getFormByNameStringQuery = getFormByNameStringQuery;
768
- exports.getFormsStringQuery = `
769
- query getForms {
770
- settings_forms (
771
- order_by: {zid: desc, version: desc}
772
- ) {
773
- id
774
- zid
775
- name
776
- description
777
- version
778
- active
779
- settings_form_fields (order_by: {position: asc}) {
780
- id
781
- name
782
- field_type
783
- hint
784
- required
785
- default_value
786
- position
787
- print_var_name
788
- form_id
789
- settings_form_field_options {
790
- id
791
- label
792
- position
793
- value
794
- }
795
- }
796
- }
797
- }
798
- `;
799
- const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
800
- query getFormsByDocumentType {
801
- settings_forms (
802
- where: {
803
- ${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
804
- document_type: {_eq: "${document_type}"}
805
- },
806
- order_by: {zid: desc, version: desc}
807
- ) {
808
- id
809
- zid
810
- name
811
- description
812
- version
813
- active
814
- settings_form_fields (order_by: {position: asc}) {
815
- id
816
- name
817
- field_type
818
- hint
819
- required
820
- default_value
821
- position
822
- print_var_name
823
- form_id
824
- settings_form_field_table_headers {
825
- id
826
- name
827
- cell_type
828
- position
829
- }
830
- settings_form_field_options {
831
- id
832
- label
833
- position
834
- value
835
- }
836
- }
837
- }
838
- }
839
- `;
840
- exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
841
- const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
842
- query getMyCaseFormSubmissions {
843
- submission_cases (
844
- limit: 500,
845
- where: {
846
- settings_form_submission: {
847
- ${filters?.formZid
848
- ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
849
- : ""}
850
- voided: {_eq: false}
851
- },
852
- case: {
853
- ${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
854
- responsible_id: {_eq: ${responsible_id}}
855
- }
856
- },
857
- order_by: {id: desc})
858
- {
859
- id
860
- case_id
861
- form_submission_id
862
- case {
863
- id
864
- id_number
865
- reference
866
- date
867
- symptom
868
- solution
869
- memo
870
- client {
871
- name
872
- address_line_1
873
- }
874
- }
875
- settings_form_submission {
876
- id
877
- zid
878
- reference
879
- created_at
880
- version
881
- id_number
882
- user_id
883
- settings_form_submission_values {
884
- id
885
- form_field_id
886
- value
887
- settings_form_field {
888
- id
889
- name
890
- print_var_name
891
- field_type
892
- settings_form_field_options {
893
- id
894
- label
895
- position
896
- value
897
- }
898
- }
899
- }
900
- settings_form {
901
- id
902
- name
903
- zid
904
- description
905
- created_at
906
- version
907
- }
908
- }
909
- }
910
- }
911
- `;
912
- exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
913
- const getFormSubmissionByIdStringQuery = (formId) => `
914
- query getFormSubmissionById {
915
- settings_form_submissions (where: {id: { _eq: ${formId} }}) {
916
- id
917
- zid
918
- reference
919
- created_at
920
- version
921
- id_number
922
- settings_form {
923
- id
924
- name
925
- description
926
- }
927
- settings_form_submission_values {
928
- id
929
- form_field_id
930
- value
931
- settings_form_field {
932
- id
933
- name
934
- print_var_name
935
- field_type
936
- settings_form_field_options {
937
- id
938
- label
939
- position
940
- value
941
- }
942
- }
943
- }
944
- }
945
- }
946
- `;
947
- exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
948
- const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
949
- return `
950
- query getInvoiceFormSubmissionsByAgencyId {
951
- submission_invoices(
952
- where: {
953
- settings_form_submission: {
954
- ${filters?.formZid
955
- ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
956
- : ""}
957
- ${filters?.some_field_value
958
- ? `settings_form_submission_values: {
959
- value: { _eq: "${filters?.some_field_value}" }
960
- },`
961
- : ""}
962
- voided: {_eq: false}
963
- },
964
- ${filters?.startDate?.length && filters?.endDate?.length
965
- ? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
966
- : ""}
967
- invoice: {
968
- agency_id: {_eq: ${agency_id}},
969
- ${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
970
- ${filters?.payee_id_number_search
971
- ? `payee: {
972
- id_number: { _ilike: "%${filters?.payee_id_number_search}%"}
973
- },`
974
- : ""}
975
- ${filters?.item_ids?.length
976
- ? `invoice_details: {item_id: {_in: [${filters?.item_ids?.join(",")}]}}`
977
- : ""}
978
- ${filters?.bundle_ids?.length
979
- ? `invoice_details: {bundle_id: {_in: [${filters?.bundle_ids?.join(",")}]}}`
980
- : ""}
981
- voided: {_eq: false}
982
- }
983
- },
984
- order_by: {id: desc}
985
- )
986
- {
987
- id
988
- invoice_id
989
- form_submission_id
990
- created_at
991
- invoice {
992
- id_number
993
- date
994
- currency_id
995
- order_number
996
- seller_id
997
- payee_id
998
- payee {
999
- id_number
1000
- name
1001
- }
1002
- }
1003
- settings_form_submission {
1004
- id
1005
- zid
1006
- reference
1007
- created_at
1008
- version
1009
- id_number
1010
- settings_form_submission_values {
1011
- id
1012
- form_field_id
1013
- value
1014
- settings_form_field {
1015
- id
1016
- name
1017
- print_var_name
1018
- settings_form_field_options {
1019
- id
1020
- label
1021
- position
1022
- value
1023
- }
1024
- }
1025
- }
1026
- settings_form {
1027
- id
1028
- name
1029
- zid
1030
- description
1031
- created_at
1032
- version
1033
- }
1034
- }
1035
- }
1036
- }
1037
- `;
1038
- };
1039
- exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = getInvoiceFormSubmissionsByAgencyIdStringQuery;
1040
- const getLastInvoiceFormSubmissionStringQuery = (filters = {}) => `
1041
- query getLastInvoiceFormSubmission {
1042
- submission_invoices(
1043
- where: {
1044
- settings_form_submission: {
1045
- ${filters?.formZid
1046
- ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
1047
- : ""}
1048
- voided: {_eq: false}
1049
- }
1050
- },
1051
- order_by: {id: desc},
1052
- limit: 1
1053
- ) {
1054
- settings_form_submission {
1055
- id
1056
- id_number
1057
- }
1058
- }
1059
- }
1060
- `;
1061
- exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
1062
- const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
1063
- query getInvoiceFormSubmissionsByInvoiceId {
1064
- submission_invoices(
1065
- where: {
1066
- invoice_id: {_eq: ${invoice_id}},
1067
- settings_form_submission: {
1068
- ${filters?.formZid
1069
- ? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
1070
- : ""}
1071
- voided: {_eq: false}
1072
- }
1073
- },
1074
- order_by: {id: desc}
1075
- ) {
1076
- id
1077
- invoice_id
1078
- form_submission_id
1079
- created_at
1080
- settings_form_submission {
1081
- id
1082
- zid
1083
- reference
1084
- created_at
1085
- version
1086
- id_number
1087
- settings_form_submission_values {
1088
- id
1089
- form_field_id
1090
- value
1091
- settings_form_field {
1092
- id
1093
- name
1094
- print_var_name
1095
- settings_form_field_options {
1096
- id
1097
- label
1098
- position
1099
- value
1100
- }
1101
- }
1102
- }
1103
- settings_form {
1104
- id
1105
- name
1106
- zid
1107
- description
1108
- created_at
1109
- version
1110
- }
1111
- }
1112
- }
1113
- }
1114
- `;
1115
- exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = getInvoiceFormSubmissionsByInvoiceIdStringQuery;
1116
- exports.getCurrenciesStringQuery = `
1117
- query getCurrencies {
1118
- currencies {
1119
- id
1120
- name
1121
- prefix
1122
- code
1123
- country
1124
- plural_name
1125
- }
1126
- }
1127
- `;
1128
- const getSuggestedPricesStringQuery = (config = {
1129
- notNullPriceList: false,
1130
- withItems: false,
1131
- withItemCategories: false,
1132
- onlyCurrent: false,
1133
- }) => `
1134
- query getSuggestedPrices {
1135
- suggested_prices ${config?.notNullPriceList || config?.onlyCurrent
1136
- ? `(
1137
- where: {${[
1138
- config?.onlyCurrent ? "current: { _eq: true }" : "",
1139
- config?.notNullPriceList ? "price_list_id: { _is_null: false }" : "",
1140
- ]
1141
- .filter(Boolean)
1142
- .join(", ")}
1143
- }
1144
- )`
1145
- : ""} {
1146
- id
1147
- current
1148
- currency_id
1149
- amount
1150
- bundle_id
1151
- item_id
1152
- notes
1153
- price_list_id
1154
- flexible_price
1155
- price_list {
1156
- payee_categories {
1157
- id
1158
- }
1159
- }
1160
- ${config?.withItems
1161
- ? `item {
1162
- id
1163
- name
1164
- stocks_only_integer
1165
- code
1166
- product_type
1167
- ${config?.withItemCategories
1168
- ? `
1169
- item_category {
1170
- id
1171
- name
1172
- notes
1173
- items_count
1174
- }
1175
- `
1176
- : ""}
1177
- }`
1178
- : ""}
1179
- }
1180
- }
1181
- `;
1182
- exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
1183
- const getPaymentTermsStringQuery = (config = { includeDiscounts: false }) => `
1184
- query getPaymentTerms {
1185
- payment_terms {
1186
- active
1187
- id
1188
- memo
1189
- name
1190
- ${config.includeDiscounts
1191
- ? `allowed_discounts {
1192
- discount {
1193
- id
1194
- name
1195
- percent
1196
- amount
1197
- }
1198
- }`
1199
- : ""}
1200
- }
1201
- }
1202
- `;
1203
- exports.getPaymentTermsStringQuery = getPaymentTermsStringQuery;
1204
- const getPaymentMethodsStringQuery = (config) => {
1205
- const conditions = [];
1206
- if (config.onlyActives) {
1207
- conditions.push(`active: { _eq: true}`);
1208
- }
1209
- const whereClause = conditions.length
1210
- ? `where: { ${conditions.join(", ")} }`
1211
- : "";
1212
- return `query getPaymentMethods {
1213
- payment_methods (
1214
- order_by: { id: desc },
1215
- ${whereClause}
1216
- ) {
1217
- id
1218
- active
1219
- name
1220
- avoid_overpay_showing_change
1221
- }
1222
- }
1223
- `;
1224
- };
1225
- exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
1226
- const getPaymentTermByIdStringQuery = (id) => `
1227
- query getPaymentTermById {
1228
- payment_terms (where: {id: {_eq: ${id} }}) {
1229
- active
1230
- id
1231
- memo
1232
- name
1233
- account_from_id
1234
- account_to_id
1235
- allowed_payment_terms {
1236
- payee_category_id
1237
- }
1238
- }
1239
- }
1240
- `;
1241
- exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
1242
- const getInvoicesByAgencyIdStringQuery = (id) => `
1243
- query getInvoicesByAgencyId {
1244
- invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
1245
- id
1246
- zid
1247
- id_number
1248
- currency_id
1249
- date
1250
- payee_id
1251
- total
1252
- subtotal
1253
- seller_id
1254
- order_number
1255
- memo
1256
- issued
1257
- invoice_number
1258
- id_number
1259
- payment_term_id
1260
- reference
1261
- submission_invoices {
1262
- id
1263
- settings_form_submission {
1264
- zid
1265
- voided
1266
- settings_form {
1267
- id
1268
- zid
1269
- }
1270
- }
1271
- }
1272
- invoice_details {
1273
- bundle_id
1274
- id
1275
- item_bundle_name
1276
- item_bundle_description
1277
- item_id
1278
- price
1279
- quantity
1280
- unit_price
1281
- }
1282
- payee {
1283
- name
1284
- payee_category_id
1285
- }
1286
- }
1287
- }
1288
- `;
1289
- exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
1290
- const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
1291
- const additionalWheres = wheres.join(",");
1292
- return `
1293
- query getCasesByResponsibleId {
1294
- cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
1295
- id
1296
- id_number
1297
- serial_id
1298
- critical
1299
- reference
1300
- date
1301
- closing_expected_at
1302
- contact_method_id
1303
- symptom
1304
- solution
1305
- memo
1306
- closed
1307
- closed_at
1308
- seller_id
1309
- closer_id
1310
- client_id
1311
- warranty
1312
- courtesy
1313
- client {
1314
- name
1315
- address_line_1
1316
- }
1317
- case_invoices {
1318
- invoice {
1319
- id
1320
- paid
1321
- }
1322
- }
1323
- case_supplies {
1324
- id
1325
- item_id
1326
- }
1327
- }
1328
- }
1329
- `;
1330
- };
1331
- exports.getCasesByResponsibleIdStringQuery = getCasesByResponsibleIdStringQuery;
1332
- exports.getPrintTemplatesStringQuery = `
1333
- query getPrintTemplates {
1334
- print_templates {
1335
- id
1336
- name
1337
- }
1338
- }
1339
- `;
package/dist/cjs/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./GraphQL.queries.js"), exports);