@zauru-sdk/graphql 2.0.52 → 2.0.56

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.
@@ -1193,55 +1193,57 @@ const getSuggestedPricesStringQuery = (config = {
1193
1193
  withItems: false,
1194
1194
  withItemCategories: false,
1195
1195
  onlyCurrent: false,
1196
- }) => `
1197
- query getSuggestedPrices {
1198
- suggested_prices ${config?.notNullPriceList || config?.onlyCurrent
1199
- ? `(
1200
- where: {${[
1201
- config?.onlyCurrent ? "current: { _eq: true }" : "",
1202
- config?.notNullPriceList ? "price_list_id: { _is_null: false }" : "",
1203
- ]
1204
- .filter(Boolean)
1205
- .join(", ")}
1206
- }
1207
- )`
1208
- : ""} {
1209
- id
1210
- current
1211
- currency_id
1212
- amount
1213
- bundle_id
1214
- item_id
1215
- notes
1216
- price_list_id
1217
- flexible_price
1218
- price_list {
1219
- payee_categories {
1196
+ }) => {
1197
+ const conditions = [];
1198
+ if (config.onlyCurrent) {
1199
+ conditions.push("current: { _eq: true }");
1200
+ }
1201
+ if (config.notNullPriceList) {
1202
+ conditions.push("price_list_id: { _is_null: false }");
1203
+ }
1204
+ const whereClause = conditions.length
1205
+ ? `where: { ${conditions.join(", ")} }`
1206
+ : "";
1207
+ const itemCategories = config?.withItemCategories
1208
+ ? `item_category {
1209
+ id
1210
+ name
1211
+ notes
1212
+ items_count
1213
+ }
1214
+ `
1215
+ : "";
1216
+ const items = config?.withItems
1217
+ ? `item {
1220
1218
  id
1219
+ name
1220
+ stocks_only_integer
1221
+ code
1222
+ product_type
1223
+ ${itemCategories}
1224
+ }`
1225
+ : "";
1226
+ return `query getSuggestedPrices {
1227
+ suggested_prices ${whereClause} {
1228
+ id
1229
+ current
1230
+ currency_id
1231
+ amount
1232
+ bundle_id
1233
+ item_id
1234
+ notes
1235
+ price_list_id
1236
+ flexible_price
1237
+ price_list {
1238
+ payee_categories {
1239
+ id
1240
+ }
1221
1241
  }
1242
+ ${items}
1222
1243
  }
1223
- ${config?.withItems
1224
- ? `item {
1225
- id
1226
- name
1227
- stocks_only_integer
1228
- code
1229
- product_type
1230
- ${config?.withItemCategories
1231
- ? `
1232
- item_category {
1233
- id
1234
- name
1235
- notes
1236
- items_count
1237
- }
1238
- `
1239
- : ""}
1240
- }`
1241
- : ""}
1242
1244
  }
1243
- }
1244
1245
  `;
1246
+ };
1245
1247
  exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
1246
1248
  const getPaymentTermsStringQuery = (config = { includeDiscounts: false }) => `
1247
1249
  query getPaymentTerms {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/graphql",
3
- "version": "2.0.52",
3
+ "version": "2.0.56",
4
4
  "description": "Queries de uso común para las aplicación de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -21,5 +21,5 @@
21
21
  "devDependencies": {
22
22
  "typescript": "^5.1.6"
23
23
  },
24
- "gitHead": "3176c02389ca24a162796ddba4c149a3500383dc"
24
+ "gitHead": "f9ddbf6017cf7b1afff51c9e4edfb11ba2ea1bb6"
25
25
  }