@connect-plus-online/ogabai-integrations 0.0.82 → 0.0.84

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
@@ -1906,12 +1906,6 @@ var customerSchema = {
1906
1906
  variables: "($customer: CustomerInput!)",
1907
1907
  field: "(customer: $customer)"
1908
1908
  },
1909
- list: {
1910
- operation: "query",
1911
- name: "getCustomers",
1912
- variables: "($limit: Int!, $skip: Int!, $search: String, $customer: CustomerInput, $customerIds: [String])",
1913
- field: "(limit: $limit, skip: $skip, search: $search, customer: $customer, customerIds: $customerIds)"
1914
- },
1915
1909
  create: {
1916
1910
  operation: "mutation",
1917
1911
  name: "createCustomer",
@@ -1985,15 +1979,20 @@ var createCustomerService = (client) => ({
1985
1979
  }
1986
1980
  ),
1987
1981
  // only admin
1988
- getCustomers: createOperationExecutor(
1989
- client,
1990
- "getCustomers",
1991
- {
1992
- schema: buildSchema(customerSchema.list),
1993
- defaultRootFields: [...customerListIntegration.responseFields],
1994
- defaultNestedFields: customerListIntegration.nestedFields
1995
- }
1996
- ),
1982
+ // getCustomers: createOperationExecutor<
1983
+ // "getCustomers",
1984
+ // CustomerCRUD["ListRequest"],
1985
+ // CustomerCRUD["ListResponse"],
1986
+ // typeof customerListIntegration.nestedFields
1987
+ // >(
1988
+ // client,
1989
+ // "getCustomers",
1990
+ // {
1991
+ // schema: buildSchema(customerSchema.list),
1992
+ // defaultRootFields: [...customerListIntegration.responseFields],
1993
+ // defaultNestedFields: customerListIntegration.nestedFields,
1994
+ // }
1995
+ // ),
1997
1996
  getCustomersByStoreId: createOperationExecutor(
1998
1997
  client,
1999
1998
  "getCustomersByStoreId",
@@ -3204,6 +3203,21 @@ var orderSchema = {
3204
3203
  };
3205
3204
 
3206
3205
  // src/services/sales/sale.entity.ts
3206
+ var expenseQuery = [
3207
+ "id",
3208
+ "createdAt",
3209
+ "description",
3210
+ "title",
3211
+ "repeatedEvery",
3212
+ "expenseCategoryId"
3213
+ ];
3214
+ var expenseCategoryQuery = [
3215
+ "id",
3216
+ "createdAt",
3217
+ "description",
3218
+ "storeId",
3219
+ "title"
3220
+ ];
3207
3221
  var transactionQuery = [
3208
3222
  "_id",
3209
3223
  "amountPaid",
@@ -3222,6 +3236,7 @@ var transactionQuery = [
3222
3236
  "to",
3223
3237
  "toWallet",
3224
3238
  "txStatus",
3239
+ "customerId",
3225
3240
  "transactionType"
3226
3241
  ];
3227
3242
  var orderQuery = [
@@ -3445,6 +3460,32 @@ var createTransactionService = (client) => ({
3445
3460
  );
3446
3461
  return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3447
3462
  },
3463
+ async addCustomerDeposit(input, fetchFields, option) {
3464
+ return this.addTransaction(
3465
+ {
3466
+ transaction: {
3467
+ ...input,
3468
+ transactionType: "customerDeposit",
3469
+ platform: "pos"
3470
+ }
3471
+ },
3472
+ fetchFields,
3473
+ option
3474
+ );
3475
+ },
3476
+ async addCustomerRefund(input, fetchFields, option) {
3477
+ return this.addTransaction(
3478
+ {
3479
+ transaction: {
3480
+ ...input,
3481
+ transactionType: "customerRefund",
3482
+ platform: "pos"
3483
+ }
3484
+ },
3485
+ fetchFields,
3486
+ option
3487
+ );
3488
+ },
3448
3489
  async getTransaction(input, fetchFields, option) {
3449
3490
  var _a, _b, _c, _d;
3450
3491
  const res = await client.request(
@@ -3475,6 +3516,208 @@ var createTransactionService = (client) => ({
3475
3516
  }
3476
3517
  });
3477
3518
 
3519
+ // src/services/sales/types/expense-category.type.ts
3520
+ var ENTITY8 = "expenseCategory";
3521
+ var expenseCategoryIntegration = createStandardEntityIntegration({
3522
+ key: ENTITY8,
3523
+ fields: expenseCategoryQuery,
3524
+ nested: {
3525
+ features: expenseCategoryQuery
3526
+ }
3527
+ });
3528
+ var expenseCategoryListIntegration = createListIntegration({
3529
+ key: "expenseCategorys",
3530
+ fields: expenseCategoryQuery,
3531
+ nested: {
3532
+ features: expenseCategoryQuery
3533
+ }
3534
+ });
3535
+ var expenseCategoryDeleteIntegration = createDeleteIntegration(ENTITY8);
3536
+
3537
+ // src/services/sales/types/expense.type.ts
3538
+ var ENTITY9 = "expense";
3539
+ var expenseIntegration = createStandardEntityIntegration({
3540
+ key: ENTITY9,
3541
+ fields: expenseQuery,
3542
+ nested: {
3543
+ features: expenseQuery
3544
+ }
3545
+ });
3546
+ var expenseListIntegration = createListIntegration({
3547
+ key: "expenses",
3548
+ fields: expenseQuery,
3549
+ nested: {
3550
+ features: expenseQuery
3551
+ }
3552
+ });
3553
+ var expenseDeleteIntegration = createDeleteIntegration(ENTITY9);
3554
+
3555
+ // src/services/sales/schemas/expense-category.schema.ts
3556
+ var expenseCategorySchema = {
3557
+ get: {
3558
+ operation: "query",
3559
+ name: "getExpenseCategory",
3560
+ variables: "($expenseCategory: ExpenseCategoryInput!)",
3561
+ field: "(expenseCategory: $expenseCategory)"
3562
+ },
3563
+ list: {
3564
+ operation: "query",
3565
+ name: "getExpenseCategorys",
3566
+ variables: "($limit: Int!, $skip: Int!, $search: String, $expenseCategory: ExpenseCategoryInput, $expenseCategoryIds: [String])",
3567
+ field: "(limit: $limit, skip: $skip, search: $search, expenseCategory: $expenseCategory, expenseCategoryIds: $expenseCategoryIds)"
3568
+ },
3569
+ create: {
3570
+ operation: "mutation",
3571
+ name: "createExpenseCategory",
3572
+ variables: "($expenseCategory: ExpenseCategoryInput!)",
3573
+ field: "(expenseCategory: $expenseCategory)"
3574
+ },
3575
+ update: {
3576
+ operation: "mutation",
3577
+ name: "updateExpenseCategory",
3578
+ variables: "($expenseCategoryId: String!, $expenseCategory: ExpenseCategoryInput!)",
3579
+ field: "(expenseCategoryId: $expenseCategoryId, expenseCategory: $expenseCategory)"
3580
+ },
3581
+ delete: {
3582
+ operation: "mutation",
3583
+ name: "deleteExpenseCategory",
3584
+ variables: "($expenseCategoryId: String!)",
3585
+ field: "(expenseCategoryId: $expenseCategoryId)"
3586
+ }
3587
+ };
3588
+
3589
+ // src/services/sales/expense-category.service.ts
3590
+ var createExpenseCategoryService = (client) => ({
3591
+ createExpenseCategory: createOperationExecutor(
3592
+ client,
3593
+ "createExpenseCategory",
3594
+ {
3595
+ schema: buildSchema(expenseCategorySchema.create),
3596
+ defaultRootFields: expenseCategoryIntegration.create.responseFields,
3597
+ defaultNestedFields: expenseCategoryIntegration.create.nestedFields
3598
+ }
3599
+ ),
3600
+ updateExpenseCategory: createOperationExecutor(
3601
+ client,
3602
+ "updateExpenseCategory",
3603
+ {
3604
+ schema: buildSchema(expenseCategorySchema.update),
3605
+ defaultRootFields: expenseCategoryIntegration.update.responseFields,
3606
+ defaultNestedFields: expenseCategoryIntegration.update.nestedFields
3607
+ }
3608
+ ),
3609
+ getExpenseCategory: createOperationExecutor(
3610
+ client,
3611
+ "getExpenseCategory",
3612
+ {
3613
+ schema: buildSchema(expenseCategorySchema.get),
3614
+ defaultRootFields: expenseCategoryIntegration.get.responseFields,
3615
+ defaultNestedFields: expenseCategoryIntegration.get.nestedFields
3616
+ }
3617
+ ),
3618
+ deleteExpenseCategory: createOperationExecutor(
3619
+ client,
3620
+ "deleteExpenseCategory",
3621
+ {
3622
+ schema: buildSchema(expenseCategorySchema.delete),
3623
+ defaultRootFields: expenseCategoryDeleteIntegration.responseFields,
3624
+ defaultNestedFields: {}
3625
+ }
3626
+ ),
3627
+ getExpenseCategorys: createOperationExecutor(
3628
+ client,
3629
+ "getExpenseCategorys",
3630
+ {
3631
+ schema: buildSchema(expenseCategorySchema.list),
3632
+ defaultRootFields: [...expenseCategoryListIntegration.responseFields],
3633
+ defaultNestedFields: expenseCategoryListIntegration.nestedFields
3634
+ }
3635
+ )
3636
+ });
3637
+
3638
+ // src/services/sales/schemas/expense.schema.ts
3639
+ var expenseSchema = {
3640
+ get: {
3641
+ operation: "query",
3642
+ name: "getExpense",
3643
+ variables: "($expense: ExpenseInput!)",
3644
+ field: "(expense: $expense)"
3645
+ },
3646
+ list: {
3647
+ operation: "query",
3648
+ name: "getExpenses",
3649
+ variables: "($limit: Int!, $skip: Int!, $search: String, $expense: ExpenseInput, $expenseIds: [String])",
3650
+ field: "(limit: $limit, skip: $skip, search: $search, expense: $expense, expenseIds: $expenseIds)"
3651
+ },
3652
+ create: {
3653
+ operation: "mutation",
3654
+ name: "createExpense",
3655
+ variables: "($expense: ExpenseInput!)",
3656
+ field: "(expense: $expense)"
3657
+ },
3658
+ update: {
3659
+ operation: "mutation",
3660
+ name: "updateExpense",
3661
+ variables: "($expenseId: String!, $expense: ExpenseInput!)",
3662
+ field: "(expenseId: $expenseId, expense: $expense)"
3663
+ },
3664
+ delete: {
3665
+ operation: "mutation",
3666
+ name: "deleteExpense",
3667
+ variables: "($expenseId: String!)",
3668
+ field: "(expenseId: $expenseId)"
3669
+ }
3670
+ };
3671
+
3672
+ // src/services/sales/expense.service.ts
3673
+ var createExpenseService = (client) => ({
3674
+ createExpense: createOperationExecutor(
3675
+ client,
3676
+ "createExpense",
3677
+ {
3678
+ schema: buildSchema(expenseSchema.create),
3679
+ defaultRootFields: expenseIntegration.create.responseFields,
3680
+ defaultNestedFields: expenseIntegration.create.nestedFields
3681
+ }
3682
+ ),
3683
+ updateExpense: createOperationExecutor(
3684
+ client,
3685
+ "updateExpense",
3686
+ {
3687
+ schema: buildSchema(expenseSchema.update),
3688
+ defaultRootFields: expenseIntegration.update.responseFields,
3689
+ defaultNestedFields: expenseIntegration.update.nestedFields
3690
+ }
3691
+ ),
3692
+ getExpense: createOperationExecutor(
3693
+ client,
3694
+ "getExpense",
3695
+ {
3696
+ schema: buildSchema(expenseSchema.get),
3697
+ defaultRootFields: expenseIntegration.get.responseFields,
3698
+ defaultNestedFields: expenseIntegration.get.nestedFields
3699
+ }
3700
+ ),
3701
+ deleteExpense: createOperationExecutor(
3702
+ client,
3703
+ "deleteExpense",
3704
+ {
3705
+ schema: buildSchema(expenseSchema.delete),
3706
+ defaultRootFields: expenseDeleteIntegration.responseFields,
3707
+ defaultNestedFields: {}
3708
+ }
3709
+ ),
3710
+ getExpenses: createOperationExecutor(
3711
+ client,
3712
+ "getExpenses",
3713
+ {
3714
+ schema: buildSchema(expenseSchema.list),
3715
+ defaultRootFields: [...expenseListIntegration.responseFields],
3716
+ defaultNestedFields: expenseListIntegration.nestedFields
3717
+ }
3718
+ )
3719
+ });
3720
+
3478
3721
  exports.APPLICATION_FEATURES = APPLICATION_FEATURES;
3479
3722
  exports.AuthenticationError = AuthenticationError;
3480
3723
  exports.GraphQLClient = GraphQLClient;
@@ -3510,6 +3753,8 @@ exports.addTransactionResponseNestedFields = addTransactionResponseNestedFields;
3510
3753
  exports.compose = compose;
3511
3754
  exports.createAuthService = createAuthService;
3512
3755
  exports.createCustomerService = createCustomerService;
3756
+ exports.createExpenseCategoryService = createExpenseCategoryService;
3757
+ exports.createExpenseService = createExpenseService;
3513
3758
  exports.createOrderService = createOrderService;
3514
3759
  exports.createPackageService = createPackageService;
3515
3760
  exports.createPaystackService = createPaystackService;
@@ -3535,6 +3780,14 @@ exports.createUserAccountService = createUserAccountService;
3535
3780
  exports.createUserNotificationService = createUserNotificationService;
3536
3781
  exports.createUserRoleService = createUserRoleService;
3537
3782
  exports.createUserService = createUserService;
3783
+ exports.expenseCategoryDeleteIntegration = expenseCategoryDeleteIntegration;
3784
+ exports.expenseCategoryIntegration = expenseCategoryIntegration;
3785
+ exports.expenseCategoryListIntegration = expenseCategoryListIntegration;
3786
+ exports.expenseCategoryQuery = expenseCategoryQuery;
3787
+ exports.expenseDeleteIntegration = expenseDeleteIntegration;
3788
+ exports.expenseIntegration = expenseIntegration;
3789
+ exports.expenseListIntegration = expenseListIntegration;
3790
+ exports.expenseQuery = expenseQuery;
3538
3791
  exports.getCustomerProductCountsByIdsResponse = getCustomerProductCountsByIdsResponse;
3539
3792
  exports.getCustomerProductCountsByIdsResponseNestedFields = getCustomerProductCountsByIdsResponseNestedFields;
3540
3793
  exports.getOrderResponse = getOrderResponse;