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

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.d.mts CHANGED
@@ -1,3 +1,6 @@
1
+ import * as _chijioke_graphql_client from '@chijioke/graphql-client';
2
+ import { EntityCRUD as EntityCRUD$1 } from '@chijioke/graphql-client';
3
+
1
4
  interface StoreCategory {
2
5
  _id: string;
3
6
  name: string;
@@ -103,6 +106,7 @@ interface Stock {
103
106
  storeId: string;
104
107
  createdAt: string;
105
108
  expirationDate: string;
109
+ stockType: "market" | "saleReturn";
106
110
  }
107
111
  interface StoreSetting {
108
112
  _id: string;
@@ -378,7 +382,7 @@ type SaleStatus = "paid" | "credit";
378
382
  type PaymentType = "cash" | "card" | "transfer" | "wallet";
379
383
  type Platform = "pos" | "commerce" | "wallet";
380
384
  type TxStatus = "pending" | "processing" | "completed" | "failed";
381
- type TransactionType = "sale" | "refund" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit" | "expense";
385
+ type TransactionType = "sale" | "saleReturn" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit" | "expense";
382
386
  type Transaction = {
383
387
  _id: string;
384
388
  from: string;
@@ -403,6 +407,7 @@ type Transaction = {
403
407
  expenseId: string;
404
408
  narration: string;
405
409
  expenseReceiptUrl: string;
410
+ parentTransactionId: string;
406
411
  };
407
412
  type OrderStatus = "pending" | "processing" | "routing" | "delivered";
408
413
  type Order = {
@@ -1959,7 +1964,21 @@ declare const updateTransactionResponse: "transaction"[];
1959
1964
  type UpdateTransactionResponseNestedFields = GetTransactionResponseNestedFields;
1960
1965
  declare const updateTransactionResponseNestedFields: GetTransactionResponseNestedFields;
1961
1966
 
1967
+ type SelectFields<T, R extends keyof T, O extends keyof T = never> = Required<Pick<T, R>> & Partial<Pick<T, O>>;
1962
1968
  declare const createTransactionService: (client: GraphQLClient) => {
1969
+ /**
1970
+ *
1971
+ * @param input transactionRequest
1972
+ * @param fetchFields filter what is returned (fields)
1973
+ * @param option call options - cache
1974
+ * @returns TransactionResponse
1975
+ */
1976
+ returnSales(input: {
1977
+ transaction: SelectFields<Transaction, "createdById" | "parentTransactionId" | "amountPaid" | "sales", "customerId" | "narration">;
1978
+ }, fetchFields?: {
1979
+ root?: (keyof UpdateTransactionResponse)[];
1980
+ nestedFields?: UpdateTransactionResponseNestedFields;
1981
+ }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1963
1982
  /**
1964
1983
  * Uploads a transaction receipt
1965
1984
  * @param form {
@@ -1974,10 +1993,10 @@ declare const createTransactionService: (client: GraphQLClient) => {
1974
1993
  root?: (keyof UpdateTransactionResponse)[];
1975
1994
  nestedFields?: UpdateTransactionResponseNestedFields;
1976
1995
  }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1977
- addTransaction(input: AddTransactionRequest, fetchFields?: {
1996
+ addTransaction: (input: AddTransactionRequest, fetchFields?: {
1978
1997
  root?: (keyof AddTransactionResponse)[];
1979
1998
  nestedFields?: AddTransactionResponseNestedFields;
1980
- }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1999
+ }, option?: RequestOption) => Promise<AddTransactionResponse | null>;
1981
2000
  addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid" | "createdById">, fetchFields?: {
1982
2001
  root?: (keyof AddTransactionResponse)[];
1983
2002
  nestedFields?: AddTransactionResponseNestedFields;
@@ -1998,7 +2017,7 @@ declare const createTransactionService: (client: GraphQLClient) => {
1998
2017
  type TransactionService = ReturnType<typeof createTransactionService>;
1999
2018
 
2000
2019
  declare const ENTITY$5: "expenseCategory";
2001
- type ExpenseCategoryCRUD = EntityCRUD<ExpenseCategory, typeof ENTITY$5>;
2020
+ type ExpenseCategoryCRUD = EntityCRUD$1<ExpenseCategory, typeof ENTITY$5>;
2002
2021
  declare const expenseCategoryIntegration: {
2003
2022
  get: {
2004
2023
  responseFields: ["expenseCategory"];
@@ -2030,7 +2049,7 @@ declare const expenseCategoryDeleteIntegration: {
2030
2049
  };
2031
2050
 
2032
2051
  declare const ENTITY$4: "expense";
2033
- type ExpenseCRUD = EntityCRUD<Expense, typeof ENTITY$4>;
2052
+ type ExpenseCRUD = EntityCRUD$1<Expense, typeof ENTITY$4>;
2034
2053
  declare const expenseIntegration: {
2035
2054
  get: {
2036
2055
  responseFields: ["expense"];
@@ -2062,73 +2081,73 @@ declare const expenseDeleteIntegration: {
2062
2081
  };
2063
2082
 
2064
2083
  declare const createExpenseCategoryService: (client: GraphQLClient) => {
2065
- createExpenseCategory: (input: CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2084
+ createExpenseCategory: (input: _chijioke_graphql_client.CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2066
2085
  root?: "expenseCategory"[] | undefined;
2067
2086
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2068
2087
  features: ExpenseCategoryFields;
2069
2088
  }) | undefined;
2070
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2071
- updateExpenseCategory: (input: UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2089
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2090
+ updateExpenseCategory: (input: _chijioke_graphql_client.UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2072
2091
  root?: "expenseCategory"[] | undefined;
2073
2092
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2074
2093
  features: ExpenseCategoryFields;
2075
2094
  }) | undefined;
2076
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2077
- getExpenseCategory: (input: GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2095
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2096
+ getExpenseCategory: (input: _chijioke_graphql_client.GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2078
2097
  root?: "expenseCategory"[] | undefined;
2079
2098
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2080
2099
  features: ExpenseCategoryFields;
2081
2100
  }) | undefined;
2082
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2083
- deleteExpenseCategory: (input: DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2101
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2102
+ deleteExpenseCategory: (input: _chijioke_graphql_client.DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2084
2103
  root?: "expenseCategoryId"[] | undefined;
2085
2104
  nestedFields?: {} | undefined;
2086
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2087
- getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2105
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expenseCategory"> | undefined>;
2106
+ getExpenseCategories: (input: _chijioke_graphql_client.ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2088
2107
  root?: ("total" | "expenseCategories")[] | undefined;
2089
2108
  nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2090
2109
  features: ExpenseCategoryFields;
2091
2110
  }) | undefined;
2092
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2111
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2093
2112
  };
2094
2113
  type ExpenseCategoryService = ReturnType<typeof createExpenseCategoryService>;
2095
2114
 
2096
2115
  declare const createExpenseService: (client: GraphQLClient) => {
2097
- createExpense: (input: CreateEntityRequest<Expense, "expense">, fetchFields?: {
2116
+ createExpense: (input: _chijioke_graphql_client.CreateEntityRequest<Expense, "expense">, fetchFields?: {
2098
2117
  root?: "expense"[] | undefined;
2099
2118
  nestedFields?: (Record<"expense", ExpenseFields> & {
2100
2119
  features: ExpenseFields;
2101
2120
  }) | undefined;
2102
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2103
- updateExpense: (input: UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2121
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2122
+ updateExpense: (input: _chijioke_graphql_client.UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2104
2123
  root?: "expense"[] | undefined;
2105
2124
  nestedFields?: (Record<"expense", ExpenseFields> & {
2106
2125
  features: ExpenseFields;
2107
2126
  }) | undefined;
2108
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2109
- getExpense: (input: GetEntityRequest<Expense, "expense">, fetchFields?: {
2127
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2128
+ getExpense: (input: _chijioke_graphql_client.GetEntityRequest<Expense, "expense">, fetchFields?: {
2110
2129
  root?: "expense"[] | undefined;
2111
2130
  nestedFields?: (Record<"expense", ExpenseFields> & {
2112
2131
  features: ExpenseFields;
2113
2132
  }) | undefined;
2114
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2115
- deleteExpense: (input: DeleteEntityRequest<"expense">, fetchFields?: {
2133
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2134
+ deleteExpense: (input: _chijioke_graphql_client.DeleteEntityRequest<"expense">, fetchFields?: {
2116
2135
  root?: "expenseId"[] | undefined;
2117
2136
  nestedFields?: {} | undefined;
2118
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expense"> | undefined>;
2119
- getExpenses: (input: ListEntityRequest<Expense, "expense">, fetchFields?: {
2137
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expense"> | undefined>;
2138
+ getExpenses: (input: _chijioke_graphql_client.ListEntityRequest<Expense, "expense">, fetchFields?: {
2120
2139
  root?: ("total" | "expenses")[] | undefined;
2121
2140
  nestedFields?: (Record<"expenses", ExpenseFields> & {
2122
2141
  features: ExpenseFields;
2123
2142
  }) | undefined;
2124
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2143
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2125
2144
  getExpensesByStaffId(req: {
2126
2145
  staffId: string;
2127
2146
  limit: number;
2128
2147
  skip: number;
2129
2148
  filter?: Partial<Omit<Expense, "dispenseStaffIds">>;
2130
- }): Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2131
- requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<EntityResponse<Expense, "expense"> | undefined>;
2149
+ }): Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2150
+ requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2132
2151
  };
2133
2152
  type ExpenseService = ReturnType<typeof createExpenseService>;
2134
2153
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import * as _chijioke_graphql_client from '@chijioke/graphql-client';
2
+ import { EntityCRUD as EntityCRUD$1 } from '@chijioke/graphql-client';
3
+
1
4
  interface StoreCategory {
2
5
  _id: string;
3
6
  name: string;
@@ -103,6 +106,7 @@ interface Stock {
103
106
  storeId: string;
104
107
  createdAt: string;
105
108
  expirationDate: string;
109
+ stockType: "market" | "saleReturn";
106
110
  }
107
111
  interface StoreSetting {
108
112
  _id: string;
@@ -378,7 +382,7 @@ type SaleStatus = "paid" | "credit";
378
382
  type PaymentType = "cash" | "card" | "transfer" | "wallet";
379
383
  type Platform = "pos" | "commerce" | "wallet";
380
384
  type TxStatus = "pending" | "processing" | "completed" | "failed";
381
- type TransactionType = "sale" | "refund" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit" | "expense";
385
+ type TransactionType = "sale" | "saleReturn" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit" | "expense";
382
386
  type Transaction = {
383
387
  _id: string;
384
388
  from: string;
@@ -403,6 +407,7 @@ type Transaction = {
403
407
  expenseId: string;
404
408
  narration: string;
405
409
  expenseReceiptUrl: string;
410
+ parentTransactionId: string;
406
411
  };
407
412
  type OrderStatus = "pending" | "processing" | "routing" | "delivered";
408
413
  type Order = {
@@ -1959,7 +1964,21 @@ declare const updateTransactionResponse: "transaction"[];
1959
1964
  type UpdateTransactionResponseNestedFields = GetTransactionResponseNestedFields;
1960
1965
  declare const updateTransactionResponseNestedFields: GetTransactionResponseNestedFields;
1961
1966
 
1967
+ type SelectFields<T, R extends keyof T, O extends keyof T = never> = Required<Pick<T, R>> & Partial<Pick<T, O>>;
1962
1968
  declare const createTransactionService: (client: GraphQLClient) => {
1969
+ /**
1970
+ *
1971
+ * @param input transactionRequest
1972
+ * @param fetchFields filter what is returned (fields)
1973
+ * @param option call options - cache
1974
+ * @returns TransactionResponse
1975
+ */
1976
+ returnSales(input: {
1977
+ transaction: SelectFields<Transaction, "createdById" | "parentTransactionId" | "amountPaid" | "sales", "customerId" | "narration">;
1978
+ }, fetchFields?: {
1979
+ root?: (keyof UpdateTransactionResponse)[];
1980
+ nestedFields?: UpdateTransactionResponseNestedFields;
1981
+ }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1963
1982
  /**
1964
1983
  * Uploads a transaction receipt
1965
1984
  * @param form {
@@ -1974,10 +1993,10 @@ declare const createTransactionService: (client: GraphQLClient) => {
1974
1993
  root?: (keyof UpdateTransactionResponse)[];
1975
1994
  nestedFields?: UpdateTransactionResponseNestedFields;
1976
1995
  }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1977
- addTransaction(input: AddTransactionRequest, fetchFields?: {
1996
+ addTransaction: (input: AddTransactionRequest, fetchFields?: {
1978
1997
  root?: (keyof AddTransactionResponse)[];
1979
1998
  nestedFields?: AddTransactionResponseNestedFields;
1980
- }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1999
+ }, option?: RequestOption) => Promise<AddTransactionResponse | null>;
1981
2000
  addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid" | "createdById">, fetchFields?: {
1982
2001
  root?: (keyof AddTransactionResponse)[];
1983
2002
  nestedFields?: AddTransactionResponseNestedFields;
@@ -1998,7 +2017,7 @@ declare const createTransactionService: (client: GraphQLClient) => {
1998
2017
  type TransactionService = ReturnType<typeof createTransactionService>;
1999
2018
 
2000
2019
  declare const ENTITY$5: "expenseCategory";
2001
- type ExpenseCategoryCRUD = EntityCRUD<ExpenseCategory, typeof ENTITY$5>;
2020
+ type ExpenseCategoryCRUD = EntityCRUD$1<ExpenseCategory, typeof ENTITY$5>;
2002
2021
  declare const expenseCategoryIntegration: {
2003
2022
  get: {
2004
2023
  responseFields: ["expenseCategory"];
@@ -2030,7 +2049,7 @@ declare const expenseCategoryDeleteIntegration: {
2030
2049
  };
2031
2050
 
2032
2051
  declare const ENTITY$4: "expense";
2033
- type ExpenseCRUD = EntityCRUD<Expense, typeof ENTITY$4>;
2052
+ type ExpenseCRUD = EntityCRUD$1<Expense, typeof ENTITY$4>;
2034
2053
  declare const expenseIntegration: {
2035
2054
  get: {
2036
2055
  responseFields: ["expense"];
@@ -2062,73 +2081,73 @@ declare const expenseDeleteIntegration: {
2062
2081
  };
2063
2082
 
2064
2083
  declare const createExpenseCategoryService: (client: GraphQLClient) => {
2065
- createExpenseCategory: (input: CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2084
+ createExpenseCategory: (input: _chijioke_graphql_client.CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2066
2085
  root?: "expenseCategory"[] | undefined;
2067
2086
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2068
2087
  features: ExpenseCategoryFields;
2069
2088
  }) | undefined;
2070
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2071
- updateExpenseCategory: (input: UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2089
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2090
+ updateExpenseCategory: (input: _chijioke_graphql_client.UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2072
2091
  root?: "expenseCategory"[] | undefined;
2073
2092
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2074
2093
  features: ExpenseCategoryFields;
2075
2094
  }) | undefined;
2076
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2077
- getExpenseCategory: (input: GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2095
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2096
+ getExpenseCategory: (input: _chijioke_graphql_client.GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2078
2097
  root?: "expenseCategory"[] | undefined;
2079
2098
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2080
2099
  features: ExpenseCategoryFields;
2081
2100
  }) | undefined;
2082
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2083
- deleteExpenseCategory: (input: DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2101
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2102
+ deleteExpenseCategory: (input: _chijioke_graphql_client.DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2084
2103
  root?: "expenseCategoryId"[] | undefined;
2085
2104
  nestedFields?: {} | undefined;
2086
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2087
- getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2105
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expenseCategory"> | undefined>;
2106
+ getExpenseCategories: (input: _chijioke_graphql_client.ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2088
2107
  root?: ("total" | "expenseCategories")[] | undefined;
2089
2108
  nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2090
2109
  features: ExpenseCategoryFields;
2091
2110
  }) | undefined;
2092
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2111
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2093
2112
  };
2094
2113
  type ExpenseCategoryService = ReturnType<typeof createExpenseCategoryService>;
2095
2114
 
2096
2115
  declare const createExpenseService: (client: GraphQLClient) => {
2097
- createExpense: (input: CreateEntityRequest<Expense, "expense">, fetchFields?: {
2116
+ createExpense: (input: _chijioke_graphql_client.CreateEntityRequest<Expense, "expense">, fetchFields?: {
2098
2117
  root?: "expense"[] | undefined;
2099
2118
  nestedFields?: (Record<"expense", ExpenseFields> & {
2100
2119
  features: ExpenseFields;
2101
2120
  }) | undefined;
2102
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2103
- updateExpense: (input: UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2121
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2122
+ updateExpense: (input: _chijioke_graphql_client.UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2104
2123
  root?: "expense"[] | undefined;
2105
2124
  nestedFields?: (Record<"expense", ExpenseFields> & {
2106
2125
  features: ExpenseFields;
2107
2126
  }) | undefined;
2108
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2109
- getExpense: (input: GetEntityRequest<Expense, "expense">, fetchFields?: {
2127
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2128
+ getExpense: (input: _chijioke_graphql_client.GetEntityRequest<Expense, "expense">, fetchFields?: {
2110
2129
  root?: "expense"[] | undefined;
2111
2130
  nestedFields?: (Record<"expense", ExpenseFields> & {
2112
2131
  features: ExpenseFields;
2113
2132
  }) | undefined;
2114
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2115
- deleteExpense: (input: DeleteEntityRequest<"expense">, fetchFields?: {
2133
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2134
+ deleteExpense: (input: _chijioke_graphql_client.DeleteEntityRequest<"expense">, fetchFields?: {
2116
2135
  root?: "expenseId"[] | undefined;
2117
2136
  nestedFields?: {} | undefined;
2118
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expense"> | undefined>;
2119
- getExpenses: (input: ListEntityRequest<Expense, "expense">, fetchFields?: {
2137
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expense"> | undefined>;
2138
+ getExpenses: (input: _chijioke_graphql_client.ListEntityRequest<Expense, "expense">, fetchFields?: {
2120
2139
  root?: ("total" | "expenses")[] | undefined;
2121
2140
  nestedFields?: (Record<"expenses", ExpenseFields> & {
2122
2141
  features: ExpenseFields;
2123
2142
  }) | undefined;
2124
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2143
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2125
2144
  getExpensesByStaffId(req: {
2126
2145
  staffId: string;
2127
2146
  limit: number;
2128
2147
  skip: number;
2129
2148
  filter?: Partial<Omit<Expense, "dispenseStaffIds">>;
2130
- }): Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2131
- requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<EntityResponse<Expense, "expense"> | undefined>;
2149
+ }): Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2150
+ requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2132
2151
  };
2133
2152
  type ExpenseService = ReturnType<typeof createExpenseService>;
2134
2153
 
package/dist/index.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { createStandardEntityIntegration as createStandardEntityIntegration$1, createListIntegration as createListIntegration$1, createDeleteIntegration as createDeleteIntegration$1 } from '@chijioke/graphql-client';
2
+
1
3
  // src/types/user.ts
2
4
  var AppNewFeatures = /* @__PURE__ */ ((AppNewFeatures2) => {
3
5
  AppNewFeatures2["ExpenseTracker"] = "expenseTracker";
@@ -436,7 +438,7 @@ var userSettingQuery = [
436
438
  "userId"
437
439
  ];
438
440
 
439
- // src/services/inventory/entities.ts
441
+ // src/services/inventory/inventory.entities.ts
440
442
  var customersProductCountQuery = [
441
443
  "count",
442
444
  "storeId",
@@ -477,7 +479,8 @@ var stockQuery = [
477
479
  "deduction",
478
480
  "storeId",
479
481
  "createdAt",
480
- "expirationDate"
482
+ "expirationDate",
483
+ "stockType"
481
484
  ];
482
485
  var storeQuery = [
483
486
  "_id",
@@ -3332,7 +3335,8 @@ var transactionQuery = [
3332
3335
  "transactionType",
3333
3336
  "expenseId",
3334
3337
  "expenseReceiptUrl",
3335
- "narration"
3338
+ "narration",
3339
+ "parentTransactionId"
3336
3340
  ];
3337
3341
  var orderQuery = [
3338
3342
  "_id",
@@ -3526,35 +3530,8 @@ var updateTransactionResponse = getTransactionResponse;
3526
3530
  var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
3527
3531
 
3528
3532
  // src/services/sales/transaction.service.ts
3529
- var createTransactionService = (client) => ({
3530
- /**
3531
- * Uploads a transaction receipt
3532
- * @param form {
3533
- * file: File;
3534
- * transactionId: string;
3535
- * storeId: string;
3536
- * }
3537
- * @returns Transaction with updated receipt URL
3538
- */
3539
- async uploadExpenseReceipt(form) {
3540
- const fileClient = createFileService(client);
3541
- return (await fileClient.uploadTxReceipt(form)).transaction;
3542
- },
3543
- async updateTransaction(input, fetchFields, option) {
3544
- var _a, _b, _c, _d;
3545
- const res = await client.request(
3546
- transactionSchema.updateTransaction(
3547
- gqlQueryStringBuilder(
3548
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3549
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3550
- )
3551
- ),
3552
- input,
3553
- option
3554
- );
3555
- return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3556
- },
3557
- async addTransaction(input, fetchFields, option) {
3533
+ var createTransactionService = (client) => {
3534
+ async function addTransaction(input, fetchFields, option) {
3558
3535
  var _a, _b, _c, _d;
3559
3536
  const res = await client.request(
3560
3537
  transactionSchema.addTransaction(
@@ -3567,98 +3544,139 @@ var createTransactionService = (client) => ({
3567
3544
  option
3568
3545
  );
3569
3546
  return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3570
- },
3571
- async addCustomerDeposit(input, fetchFields, option) {
3572
- return this.addTransaction(
3573
- {
3574
- transaction: {
3575
- ...input,
3576
- transactionType: "customerDeposit",
3577
- platform: "pos"
3578
- }
3579
- },
3580
- fetchFields,
3581
- option
3582
- );
3583
- },
3584
- async addCustomerRefund(input, fetchFields, option) {
3585
- return this.addTransaction(
3586
- {
3547
+ }
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({
3587
3558
  transaction: {
3588
- ...input,
3589
- transactionType: "customerRefund",
3590
- platform: "pos"
3559
+ ...input.transaction,
3560
+ transactionType: "saleReturn"
3591
3561
  }
3592
- },
3593
- fetchFields,
3594
- option
3595
- );
3596
- },
3597
- async getTransaction(input, fetchFields, option) {
3598
- var _a, _b, _c, _d;
3599
- const res = await client.request(
3600
- transactionSchema.getTransaction(
3601
- gqlQueryStringBuilder(
3602
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3603
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3604
- )
3605
- ),
3606
- input,
3607
- option
3608
- );
3609
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3610
- },
3611
- async getTransactions(input, fetchFields, option) {
3612
- var _a, _b, _c, _d;
3613
- const res = await client.request(
3614
- transactionSchema.getTransactions(
3615
- gqlQueryStringBuilder(
3616
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3617
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3618
- )
3619
- ),
3620
- input,
3621
- option
3622
- );
3623
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3624
- }
3625
- });
3626
-
3627
- // src/services/sales/types/expense-category.type.ts
3562
+ }, fetchFields, option);
3563
+ },
3564
+ /**
3565
+ * Uploads a transaction receipt
3566
+ * @param form {
3567
+ * file: File;
3568
+ * transactionId: string;
3569
+ * storeId: string;
3570
+ * }
3571
+ * @returns Transaction with updated receipt URL
3572
+ */
3573
+ async uploadExpenseReceipt(form) {
3574
+ const fileClient = createFileService(client);
3575
+ return (await fileClient.uploadTxReceipt(form)).transaction;
3576
+ },
3577
+ async updateTransaction(input, fetchFields, option) {
3578
+ var _a, _b, _c, _d;
3579
+ const res = await client.request(
3580
+ transactionSchema.updateTransaction(
3581
+ gqlQueryStringBuilder(
3582
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3583
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3584
+ )
3585
+ ),
3586
+ input,
3587
+ option
3588
+ );
3589
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3590
+ },
3591
+ addTransaction,
3592
+ async addCustomerDeposit(input, fetchFields, option) {
3593
+ return this.addTransaction(
3594
+ {
3595
+ transaction: {
3596
+ ...input,
3597
+ transactionType: "customerDeposit",
3598
+ platform: "pos"
3599
+ }
3600
+ },
3601
+ fetchFields,
3602
+ option
3603
+ );
3604
+ },
3605
+ async addCustomerRefund(input, fetchFields, option) {
3606
+ return this.addTransaction(
3607
+ {
3608
+ transaction: {
3609
+ ...input,
3610
+ transactionType: "customerRefund",
3611
+ platform: "pos"
3612
+ }
3613
+ },
3614
+ fetchFields,
3615
+ option
3616
+ );
3617
+ },
3618
+ async getTransaction(input, fetchFields, option) {
3619
+ var _a, _b, _c, _d;
3620
+ const res = await client.request(
3621
+ transactionSchema.getTransaction(
3622
+ gqlQueryStringBuilder(
3623
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3624
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3625
+ )
3626
+ ),
3627
+ input,
3628
+ option
3629
+ );
3630
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3631
+ },
3632
+ async getTransactions(input, fetchFields, option) {
3633
+ var _a, _b, _c, _d;
3634
+ const res = await client.request(
3635
+ transactionSchema.getTransactions(
3636
+ gqlQueryStringBuilder(
3637
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3638
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3639
+ )
3640
+ ),
3641
+ input,
3642
+ option
3643
+ );
3644
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3645
+ }
3646
+ };
3647
+ };
3628
3648
  var ENTITY8 = "expenseCategory";
3629
- var expenseCategoryIntegration = createStandardEntityIntegration({
3649
+ var expenseCategoryIntegration = createStandardEntityIntegration$1({
3630
3650
  key: ENTITY8,
3631
3651
  fields: expenseCategoryQuery,
3632
3652
  nested: {
3633
3653
  features: expenseCategoryQuery
3634
3654
  }
3635
3655
  });
3636
- var expenseCategoryListIntegration = createListIntegration({
3656
+ var expenseCategoryListIntegration = createListIntegration$1({
3637
3657
  key: ENTITY8,
3638
3658
  fields: expenseCategoryQuery,
3639
3659
  nested: {
3640
3660
  features: expenseCategoryQuery
3641
3661
  }
3642
3662
  });
3643
- var expenseCategoryDeleteIntegration = createDeleteIntegration(ENTITY8);
3644
-
3645
- // src/services/sales/types/expense.type.ts
3663
+ var expenseCategoryDeleteIntegration = createDeleteIntegration$1(ENTITY8);
3646
3664
  var ENTITY9 = "expense";
3647
- var expenseIntegration = createStandardEntityIntegration({
3665
+ var expenseIntegration = createStandardEntityIntegration$1({
3648
3666
  key: ENTITY9,
3649
3667
  fields: expenseQuery,
3650
3668
  nested: {
3651
3669
  features: expenseQuery
3652
3670
  }
3653
3671
  });
3654
- var expenseListIntegration = createListIntegration({
3672
+ var expenseListIntegration = createListIntegration$1({
3655
3673
  key: ENTITY9,
3656
3674
  fields: expenseQuery,
3657
3675
  nested: {
3658
3676
  features: expenseQuery
3659
3677
  }
3660
3678
  });
3661
- var expenseDeleteIntegration = createDeleteIntegration(ENTITY9);
3679
+ var expenseDeleteIntegration = createDeleteIntegration$1(ENTITY9);
3662
3680
 
3663
3681
  // src/services/sales/schemas/expense-category.schema.ts
3664
3682
  var expenseCategorySchema = {