@connect-plus-online/ogabai-integrations 0.0.105 → 0.0.106

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/dist/index.cjs.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var graphqlClient = require('@chijioke/graphql-client');
4
+
3
5
  // src/types/user.ts
4
6
  var AppNewFeatures = /* @__PURE__ */ ((AppNewFeatures2) => {
5
7
  AppNewFeatures2["ExpenseTracker"] = "expenseTracker";
@@ -3528,35 +3530,8 @@ var updateTransactionResponse = getTransactionResponse;
3528
3530
  var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
3529
3531
 
3530
3532
  // src/services/sales/transaction.service.ts
3531
- var createTransactionService = (client) => ({
3532
- /**
3533
- * Uploads a transaction receipt
3534
- * @param form {
3535
- * file: File;
3536
- * transactionId: string;
3537
- * storeId: string;
3538
- * }
3539
- * @returns Transaction with updated receipt URL
3540
- */
3541
- async uploadExpenseReceipt(form) {
3542
- const fileClient = createFileService(client);
3543
- return (await fileClient.uploadTxReceipt(form)).transaction;
3544
- },
3545
- async updateTransaction(input, fetchFields, option) {
3546
- var _a, _b, _c, _d;
3547
- const res = await client.request(
3548
- transactionSchema.updateTransaction(
3549
- gqlQueryStringBuilder(
3550
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3551
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3552
- )
3553
- ),
3554
- input,
3555
- option
3556
- );
3557
- return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3558
- },
3559
- async addTransaction(input, fetchFields, option) {
3533
+ var createTransactionService = (client) => {
3534
+ async function addTransaction(input, fetchFields, option) {
3560
3535
  var _a, _b, _c, _d;
3561
3536
  const res = await client.request(
3562
3537
  transactionSchema.addTransaction(
@@ -3569,98 +3544,134 @@ var createTransactionService = (client) => ({
3569
3544
  option
3570
3545
  );
3571
3546
  return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3572
- },
3573
- async addCustomerDeposit(input, fetchFields, option) {
3574
- return this.addTransaction(
3575
- {
3576
- transaction: {
3577
- ...input,
3578
- transactionType: "customerDeposit",
3579
- platform: "pos"
3580
- }
3581
- },
3582
- fetchFields,
3583
- option
3584
- );
3585
- },
3586
- async addCustomerRefund(input, fetchFields, option) {
3587
- return this.addTransaction(
3588
- {
3589
- transaction: {
3590
- ...input,
3591
- transactionType: "customerRefund",
3592
- platform: "pos"
3593
- }
3594
- },
3595
- fetchFields,
3596
- option
3597
- );
3598
- },
3599
- async getTransaction(input, fetchFields, option) {
3600
- var _a, _b, _c, _d;
3601
- const res = await client.request(
3602
- transactionSchema.getTransaction(
3603
- gqlQueryStringBuilder(
3604
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3605
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3606
- )
3607
- ),
3608
- input,
3609
- option
3610
- );
3611
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3612
- },
3613
- async getTransactions(input, fetchFields, option) {
3614
- var _a, _b, _c, _d;
3615
- const res = await client.request(
3616
- transactionSchema.getTransactions(
3617
- gqlQueryStringBuilder(
3618
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3619
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3620
- )
3621
- ),
3622
- input,
3623
- option
3624
- );
3625
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3626
3547
  }
3627
- });
3628
-
3629
- // src/services/sales/types/expense-category.type.ts
3548
+ return {
3549
+ /**
3550
+ *
3551
+ * @param input transactionRequest
3552
+ * @param fetchFields filter what is returned (fields)
3553
+ * @param option call options - cache
3554
+ * @returns TransactionResponse
3555
+ */
3556
+ async returnSales(input, fetchFields, option) {
3557
+ return addTransaction(input, fetchFields, option);
3558
+ },
3559
+ /**
3560
+ * Uploads a transaction receipt
3561
+ * @param form {
3562
+ * file: File;
3563
+ * transactionId: string;
3564
+ * storeId: string;
3565
+ * }
3566
+ * @returns Transaction with updated receipt URL
3567
+ */
3568
+ async uploadExpenseReceipt(form) {
3569
+ const fileClient = createFileService(client);
3570
+ return (await fileClient.uploadTxReceipt(form)).transaction;
3571
+ },
3572
+ async updateTransaction(input, fetchFields, option) {
3573
+ var _a, _b, _c, _d;
3574
+ const res = await client.request(
3575
+ transactionSchema.updateTransaction(
3576
+ gqlQueryStringBuilder(
3577
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3578
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3579
+ )
3580
+ ),
3581
+ input,
3582
+ option
3583
+ );
3584
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3585
+ },
3586
+ addTransaction,
3587
+ async addCustomerDeposit(input, fetchFields, option) {
3588
+ return this.addTransaction(
3589
+ {
3590
+ transaction: {
3591
+ ...input,
3592
+ transactionType: "customerDeposit",
3593
+ platform: "pos"
3594
+ }
3595
+ },
3596
+ fetchFields,
3597
+ option
3598
+ );
3599
+ },
3600
+ async addCustomerRefund(input, fetchFields, option) {
3601
+ return this.addTransaction(
3602
+ {
3603
+ transaction: {
3604
+ ...input,
3605
+ transactionType: "customerRefund",
3606
+ platform: "pos"
3607
+ }
3608
+ },
3609
+ fetchFields,
3610
+ option
3611
+ );
3612
+ },
3613
+ async getTransaction(input, fetchFields, option) {
3614
+ var _a, _b, _c, _d;
3615
+ const res = await client.request(
3616
+ transactionSchema.getTransaction(
3617
+ gqlQueryStringBuilder(
3618
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3619
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3620
+ )
3621
+ ),
3622
+ input,
3623
+ option
3624
+ );
3625
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3626
+ },
3627
+ async getTransactions(input, fetchFields, option) {
3628
+ var _a, _b, _c, _d;
3629
+ const res = await client.request(
3630
+ transactionSchema.getTransactions(
3631
+ gqlQueryStringBuilder(
3632
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3633
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3634
+ )
3635
+ ),
3636
+ input,
3637
+ option
3638
+ );
3639
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3640
+ }
3641
+ };
3642
+ };
3630
3643
  var ENTITY8 = "expenseCategory";
3631
- var expenseCategoryIntegration = createStandardEntityIntegration({
3644
+ var expenseCategoryIntegration = graphqlClient.createStandardEntityIntegration({
3632
3645
  key: ENTITY8,
3633
3646
  fields: expenseCategoryQuery,
3634
3647
  nested: {
3635
3648
  features: expenseCategoryQuery
3636
3649
  }
3637
3650
  });
3638
- var expenseCategoryListIntegration = createListIntegration({
3651
+ var expenseCategoryListIntegration = graphqlClient.createListIntegration({
3639
3652
  key: ENTITY8,
3640
3653
  fields: expenseCategoryQuery,
3641
3654
  nested: {
3642
3655
  features: expenseCategoryQuery
3643
3656
  }
3644
3657
  });
3645
- var expenseCategoryDeleteIntegration = createDeleteIntegration(ENTITY8);
3646
-
3647
- // src/services/sales/types/expense.type.ts
3658
+ var expenseCategoryDeleteIntegration = graphqlClient.createDeleteIntegration(ENTITY8);
3648
3659
  var ENTITY9 = "expense";
3649
- var expenseIntegration = createStandardEntityIntegration({
3660
+ var expenseIntegration = graphqlClient.createStandardEntityIntegration({
3650
3661
  key: ENTITY9,
3651
3662
  fields: expenseQuery,
3652
3663
  nested: {
3653
3664
  features: expenseQuery
3654
3665
  }
3655
3666
  });
3656
- var expenseListIntegration = createListIntegration({
3667
+ var expenseListIntegration = graphqlClient.createListIntegration({
3657
3668
  key: ENTITY9,
3658
3669
  fields: expenseQuery,
3659
3670
  nested: {
3660
3671
  features: expenseQuery
3661
3672
  }
3662
3673
  });
3663
- var expenseDeleteIntegration = createDeleteIntegration(ENTITY9);
3674
+ var expenseDeleteIntegration = graphqlClient.createDeleteIntegration(ENTITY9);
3664
3675
 
3665
3676
  // src/services/sales/schemas/expense-category.schema.ts
3666
3677
  var expenseCategorySchema = {