@connect-plus-online/ogabai-integrations 0.0.104 → 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.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;
@@ -676,8 +680,12 @@ type PackageFields = (keyof ProductPackage)[];
676
680
  type ProductNamesFields = (keyof ProductName)[];
677
681
  type ProductFields = (keyof Product)[];
678
682
 
683
+ declare enum TEST_FEATURES {
684
+ EXPENSE_TRACKER = "expenseTracker",
685
+ PRODUCT_IMPORT = "productImport"
686
+ }
679
687
  interface GetAppTestFeatureEnabledResponse {
680
- testFeatureEnabled: string[];
688
+ testFeatureEnabled: boolean;
681
689
  }
682
690
  interface GetAppTestFeaturesResponse {
683
691
  testFeatures: string[];
@@ -770,6 +778,7 @@ interface MeResponseNestedFields extends GetUserResponseNestedFields {
770
778
  }
771
779
 
772
780
  declare const createUserService: (client: GraphQLClient) => {
781
+ featureTestPhase(featureName: TEST_FEATURES, testFeatures: string[]): Promise<boolean>;
773
782
  getTestFeatureEnabled(fetchFields?: {
774
783
  root?: (keyof GetAppTestFeatureEnabledResponse)[];
775
784
  }, option?: RequestOption): Promise<GetAppTestFeatureEnabledResponse | undefined>;
@@ -1954,7 +1963,21 @@ declare const updateTransactionResponse: "transaction"[];
1954
1963
  type UpdateTransactionResponseNestedFields = GetTransactionResponseNestedFields;
1955
1964
  declare const updateTransactionResponseNestedFields: GetTransactionResponseNestedFields;
1956
1965
 
1966
+ type SelectFields<T, R extends keyof T, O extends keyof T = never> = Required<Pick<T, R>> & Partial<Pick<T, O>>;
1957
1967
  declare const createTransactionService: (client: GraphQLClient) => {
1968
+ /**
1969
+ *
1970
+ * @param input transactionRequest
1971
+ * @param fetchFields filter what is returned (fields)
1972
+ * @param option call options - cache
1973
+ * @returns TransactionResponse
1974
+ */
1975
+ returnSales(input: {
1976
+ transaction: SelectFields<Transaction, "amountPaid" | "sales", "customerId" | "narration">;
1977
+ }, fetchFields?: {
1978
+ root?: (keyof UpdateTransactionResponse)[];
1979
+ nestedFields?: UpdateTransactionResponseNestedFields;
1980
+ }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1958
1981
  /**
1959
1982
  * Uploads a transaction receipt
1960
1983
  * @param form {
@@ -1969,10 +1992,10 @@ declare const createTransactionService: (client: GraphQLClient) => {
1969
1992
  root?: (keyof UpdateTransactionResponse)[];
1970
1993
  nestedFields?: UpdateTransactionResponseNestedFields;
1971
1994
  }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1972
- addTransaction(input: AddTransactionRequest, fetchFields?: {
1995
+ addTransaction: (input: AddTransactionRequest, fetchFields?: {
1973
1996
  root?: (keyof AddTransactionResponse)[];
1974
1997
  nestedFields?: AddTransactionResponseNestedFields;
1975
- }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1998
+ }, option?: RequestOption) => Promise<AddTransactionResponse | null>;
1976
1999
  addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid" | "createdById">, fetchFields?: {
1977
2000
  root?: (keyof AddTransactionResponse)[];
1978
2001
  nestedFields?: AddTransactionResponseNestedFields;
@@ -1993,7 +2016,7 @@ declare const createTransactionService: (client: GraphQLClient) => {
1993
2016
  type TransactionService = ReturnType<typeof createTransactionService>;
1994
2017
 
1995
2018
  declare const ENTITY$5: "expenseCategory";
1996
- type ExpenseCategoryCRUD = EntityCRUD<ExpenseCategory, typeof ENTITY$5>;
2019
+ type ExpenseCategoryCRUD = EntityCRUD$1<ExpenseCategory, typeof ENTITY$5>;
1997
2020
  declare const expenseCategoryIntegration: {
1998
2021
  get: {
1999
2022
  responseFields: ["expenseCategory"];
@@ -2025,7 +2048,7 @@ declare const expenseCategoryDeleteIntegration: {
2025
2048
  };
2026
2049
 
2027
2050
  declare const ENTITY$4: "expense";
2028
- type ExpenseCRUD = EntityCRUD<Expense, typeof ENTITY$4>;
2051
+ type ExpenseCRUD = EntityCRUD$1<Expense, typeof ENTITY$4>;
2029
2052
  declare const expenseIntegration: {
2030
2053
  get: {
2031
2054
  responseFields: ["expense"];
@@ -2057,73 +2080,73 @@ declare const expenseDeleteIntegration: {
2057
2080
  };
2058
2081
 
2059
2082
  declare const createExpenseCategoryService: (client: GraphQLClient) => {
2060
- createExpenseCategory: (input: CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2083
+ createExpenseCategory: (input: _chijioke_graphql_client.CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2061
2084
  root?: "expenseCategory"[] | undefined;
2062
2085
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2063
2086
  features: ExpenseCategoryFields;
2064
2087
  }) | undefined;
2065
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2066
- updateExpenseCategory: (input: UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2088
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2089
+ updateExpenseCategory: (input: _chijioke_graphql_client.UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2067
2090
  root?: "expenseCategory"[] | undefined;
2068
2091
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2069
2092
  features: ExpenseCategoryFields;
2070
2093
  }) | undefined;
2071
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2072
- getExpenseCategory: (input: GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2094
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2095
+ getExpenseCategory: (input: _chijioke_graphql_client.GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2073
2096
  root?: "expenseCategory"[] | undefined;
2074
2097
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2075
2098
  features: ExpenseCategoryFields;
2076
2099
  }) | undefined;
2077
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2078
- deleteExpenseCategory: (input: DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2100
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2101
+ deleteExpenseCategory: (input: _chijioke_graphql_client.DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2079
2102
  root?: "expenseCategoryId"[] | undefined;
2080
2103
  nestedFields?: {} | undefined;
2081
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2082
- getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2104
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expenseCategory"> | undefined>;
2105
+ getExpenseCategories: (input: _chijioke_graphql_client.ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2083
2106
  root?: ("total" | "expenseCategories")[] | undefined;
2084
2107
  nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2085
2108
  features: ExpenseCategoryFields;
2086
2109
  }) | undefined;
2087
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2110
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2088
2111
  };
2089
2112
  type ExpenseCategoryService = ReturnType<typeof createExpenseCategoryService>;
2090
2113
 
2091
2114
  declare const createExpenseService: (client: GraphQLClient) => {
2092
- createExpense: (input: CreateEntityRequest<Expense, "expense">, fetchFields?: {
2115
+ createExpense: (input: _chijioke_graphql_client.CreateEntityRequest<Expense, "expense">, fetchFields?: {
2093
2116
  root?: "expense"[] | undefined;
2094
2117
  nestedFields?: (Record<"expense", ExpenseFields> & {
2095
2118
  features: ExpenseFields;
2096
2119
  }) | undefined;
2097
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2098
- updateExpense: (input: UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2120
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2121
+ updateExpense: (input: _chijioke_graphql_client.UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2099
2122
  root?: "expense"[] | undefined;
2100
2123
  nestedFields?: (Record<"expense", ExpenseFields> & {
2101
2124
  features: ExpenseFields;
2102
2125
  }) | undefined;
2103
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2104
- getExpense: (input: GetEntityRequest<Expense, "expense">, fetchFields?: {
2126
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2127
+ getExpense: (input: _chijioke_graphql_client.GetEntityRequest<Expense, "expense">, fetchFields?: {
2105
2128
  root?: "expense"[] | undefined;
2106
2129
  nestedFields?: (Record<"expense", ExpenseFields> & {
2107
2130
  features: ExpenseFields;
2108
2131
  }) | undefined;
2109
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2110
- deleteExpense: (input: DeleteEntityRequest<"expense">, fetchFields?: {
2132
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2133
+ deleteExpense: (input: _chijioke_graphql_client.DeleteEntityRequest<"expense">, fetchFields?: {
2111
2134
  root?: "expenseId"[] | undefined;
2112
2135
  nestedFields?: {} | undefined;
2113
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expense"> | undefined>;
2114
- getExpenses: (input: ListEntityRequest<Expense, "expense">, fetchFields?: {
2136
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expense"> | undefined>;
2137
+ getExpenses: (input: _chijioke_graphql_client.ListEntityRequest<Expense, "expense">, fetchFields?: {
2115
2138
  root?: ("total" | "expenses")[] | undefined;
2116
2139
  nestedFields?: (Record<"expenses", ExpenseFields> & {
2117
2140
  features: ExpenseFields;
2118
2141
  }) | undefined;
2119
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2142
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2120
2143
  getExpensesByStaffId(req: {
2121
2144
  staffId: string;
2122
2145
  limit: number;
2123
2146
  skip: number;
2124
2147
  filter?: Partial<Omit<Expense, "dispenseStaffIds">>;
2125
- }): Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2126
- requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<EntityResponse<Expense, "expense"> | undefined>;
2148
+ }): Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2149
+ requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2127
2150
  };
2128
2151
  type ExpenseService = ReturnType<typeof createExpenseService>;
2129
2152
 
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;
@@ -676,8 +680,12 @@ type PackageFields = (keyof ProductPackage)[];
676
680
  type ProductNamesFields = (keyof ProductName)[];
677
681
  type ProductFields = (keyof Product)[];
678
682
 
683
+ declare enum TEST_FEATURES {
684
+ EXPENSE_TRACKER = "expenseTracker",
685
+ PRODUCT_IMPORT = "productImport"
686
+ }
679
687
  interface GetAppTestFeatureEnabledResponse {
680
- testFeatureEnabled: string[];
688
+ testFeatureEnabled: boolean;
681
689
  }
682
690
  interface GetAppTestFeaturesResponse {
683
691
  testFeatures: string[];
@@ -770,6 +778,7 @@ interface MeResponseNestedFields extends GetUserResponseNestedFields {
770
778
  }
771
779
 
772
780
  declare const createUserService: (client: GraphQLClient) => {
781
+ featureTestPhase(featureName: TEST_FEATURES, testFeatures: string[]): Promise<boolean>;
773
782
  getTestFeatureEnabled(fetchFields?: {
774
783
  root?: (keyof GetAppTestFeatureEnabledResponse)[];
775
784
  }, option?: RequestOption): Promise<GetAppTestFeatureEnabledResponse | undefined>;
@@ -1954,7 +1963,21 @@ declare const updateTransactionResponse: "transaction"[];
1954
1963
  type UpdateTransactionResponseNestedFields = GetTransactionResponseNestedFields;
1955
1964
  declare const updateTransactionResponseNestedFields: GetTransactionResponseNestedFields;
1956
1965
 
1966
+ type SelectFields<T, R extends keyof T, O extends keyof T = never> = Required<Pick<T, R>> & Partial<Pick<T, O>>;
1957
1967
  declare const createTransactionService: (client: GraphQLClient) => {
1968
+ /**
1969
+ *
1970
+ * @param input transactionRequest
1971
+ * @param fetchFields filter what is returned (fields)
1972
+ * @param option call options - cache
1973
+ * @returns TransactionResponse
1974
+ */
1975
+ returnSales(input: {
1976
+ transaction: SelectFields<Transaction, "amountPaid" | "sales", "customerId" | "narration">;
1977
+ }, fetchFields?: {
1978
+ root?: (keyof UpdateTransactionResponse)[];
1979
+ nestedFields?: UpdateTransactionResponseNestedFields;
1980
+ }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1958
1981
  /**
1959
1982
  * Uploads a transaction receipt
1960
1983
  * @param form {
@@ -1969,10 +1992,10 @@ declare const createTransactionService: (client: GraphQLClient) => {
1969
1992
  root?: (keyof UpdateTransactionResponse)[];
1970
1993
  nestedFields?: UpdateTransactionResponseNestedFields;
1971
1994
  }, option?: RequestOption): Promise<UpdateTransactionResponse | null>;
1972
- addTransaction(input: AddTransactionRequest, fetchFields?: {
1995
+ addTransaction: (input: AddTransactionRequest, fetchFields?: {
1973
1996
  root?: (keyof AddTransactionResponse)[];
1974
1997
  nestedFields?: AddTransactionResponseNestedFields;
1975
- }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1998
+ }, option?: RequestOption) => Promise<AddTransactionResponse | null>;
1976
1999
  addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid" | "createdById">, fetchFields?: {
1977
2000
  root?: (keyof AddTransactionResponse)[];
1978
2001
  nestedFields?: AddTransactionResponseNestedFields;
@@ -1993,7 +2016,7 @@ declare const createTransactionService: (client: GraphQLClient) => {
1993
2016
  type TransactionService = ReturnType<typeof createTransactionService>;
1994
2017
 
1995
2018
  declare const ENTITY$5: "expenseCategory";
1996
- type ExpenseCategoryCRUD = EntityCRUD<ExpenseCategory, typeof ENTITY$5>;
2019
+ type ExpenseCategoryCRUD = EntityCRUD$1<ExpenseCategory, typeof ENTITY$5>;
1997
2020
  declare const expenseCategoryIntegration: {
1998
2021
  get: {
1999
2022
  responseFields: ["expenseCategory"];
@@ -2025,7 +2048,7 @@ declare const expenseCategoryDeleteIntegration: {
2025
2048
  };
2026
2049
 
2027
2050
  declare const ENTITY$4: "expense";
2028
- type ExpenseCRUD = EntityCRUD<Expense, typeof ENTITY$4>;
2051
+ type ExpenseCRUD = EntityCRUD$1<Expense, typeof ENTITY$4>;
2029
2052
  declare const expenseIntegration: {
2030
2053
  get: {
2031
2054
  responseFields: ["expense"];
@@ -2057,73 +2080,73 @@ declare const expenseDeleteIntegration: {
2057
2080
  };
2058
2081
 
2059
2082
  declare const createExpenseCategoryService: (client: GraphQLClient) => {
2060
- createExpenseCategory: (input: CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2083
+ createExpenseCategory: (input: _chijioke_graphql_client.CreateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2061
2084
  root?: "expenseCategory"[] | undefined;
2062
2085
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2063
2086
  features: ExpenseCategoryFields;
2064
2087
  }) | undefined;
2065
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2066
- updateExpenseCategory: (input: UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2088
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2089
+ updateExpenseCategory: (input: _chijioke_graphql_client.UpdateEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2067
2090
  root?: "expenseCategory"[] | undefined;
2068
2091
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2069
2092
  features: ExpenseCategoryFields;
2070
2093
  }) | undefined;
2071
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2072
- getExpenseCategory: (input: GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2094
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2095
+ getExpenseCategory: (input: _chijioke_graphql_client.GetEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2073
2096
  root?: "expenseCategory"[] | undefined;
2074
2097
  nestedFields?: (Record<"expenseCategory", ExpenseCategoryFields> & {
2075
2098
  features: ExpenseCategoryFields;
2076
2099
  }) | undefined;
2077
- } | undefined, option?: RequestOption) => Promise<EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2078
- deleteExpenseCategory: (input: DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2100
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2101
+ deleteExpenseCategory: (input: _chijioke_graphql_client.DeleteEntityRequest<"expenseCategory">, fetchFields?: {
2079
2102
  root?: "expenseCategoryId"[] | undefined;
2080
2103
  nestedFields?: {} | undefined;
2081
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2082
- getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2104
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expenseCategory"> | undefined>;
2105
+ getExpenseCategories: (input: _chijioke_graphql_client.ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2083
2106
  root?: ("total" | "expenseCategories")[] | undefined;
2084
2107
  nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2085
2108
  features: ExpenseCategoryFields;
2086
2109
  }) | undefined;
2087
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2110
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
2088
2111
  };
2089
2112
  type ExpenseCategoryService = ReturnType<typeof createExpenseCategoryService>;
2090
2113
 
2091
2114
  declare const createExpenseService: (client: GraphQLClient) => {
2092
- createExpense: (input: CreateEntityRequest<Expense, "expense">, fetchFields?: {
2115
+ createExpense: (input: _chijioke_graphql_client.CreateEntityRequest<Expense, "expense">, fetchFields?: {
2093
2116
  root?: "expense"[] | undefined;
2094
2117
  nestedFields?: (Record<"expense", ExpenseFields> & {
2095
2118
  features: ExpenseFields;
2096
2119
  }) | undefined;
2097
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2098
- updateExpense: (input: UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2120
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2121
+ updateExpense: (input: _chijioke_graphql_client.UpdateEntityRequest<Expense, "expense">, fetchFields?: {
2099
2122
  root?: "expense"[] | undefined;
2100
2123
  nestedFields?: (Record<"expense", ExpenseFields> & {
2101
2124
  features: ExpenseFields;
2102
2125
  }) | undefined;
2103
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2104
- getExpense: (input: GetEntityRequest<Expense, "expense">, fetchFields?: {
2126
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2127
+ getExpense: (input: _chijioke_graphql_client.GetEntityRequest<Expense, "expense">, fetchFields?: {
2105
2128
  root?: "expense"[] | undefined;
2106
2129
  nestedFields?: (Record<"expense", ExpenseFields> & {
2107
2130
  features: ExpenseFields;
2108
2131
  }) | undefined;
2109
- } | undefined, option?: RequestOption) => Promise<EntityResponse<Expense, "expense"> | undefined>;
2110
- deleteExpense: (input: DeleteEntityRequest<"expense">, fetchFields?: {
2132
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2133
+ deleteExpense: (input: _chijioke_graphql_client.DeleteEntityRequest<"expense">, fetchFields?: {
2111
2134
  root?: "expenseId"[] | undefined;
2112
2135
  nestedFields?: {} | undefined;
2113
- } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expense"> | undefined>;
2114
- getExpenses: (input: ListEntityRequest<Expense, "expense">, fetchFields?: {
2136
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.DeleteEntityResponse<"expense"> | undefined>;
2137
+ getExpenses: (input: _chijioke_graphql_client.ListEntityRequest<Expense, "expense">, fetchFields?: {
2115
2138
  root?: ("total" | "expenses")[] | undefined;
2116
2139
  nestedFields?: (Record<"expenses", ExpenseFields> & {
2117
2140
  features: ExpenseFields;
2118
2141
  }) | undefined;
2119
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2142
+ } | undefined, option?: RequestOption) => Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2120
2143
  getExpensesByStaffId(req: {
2121
2144
  staffId: string;
2122
2145
  limit: number;
2123
2146
  skip: number;
2124
2147
  filter?: Partial<Omit<Expense, "dispenseStaffIds">>;
2125
- }): Promise<ListEntityResponse<Expense, "expense"> | undefined>;
2126
- requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<EntityResponse<Expense, "expense"> | undefined>;
2148
+ }): Promise<_chijioke_graphql_client.ListEntityResponse<Expense, "expense"> | undefined>;
2149
+ requestExpenseDispense(req: CreateEntityRequest<Expense, "expense">): Promise<_chijioke_graphql_client.EntityResponse<Expense, "expense"> | undefined>;
2127
2150
  };
2128
2151
  type ExpenseService = ReturnType<typeof createExpenseService>;
2129
2152
 
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";
@@ -1378,6 +1380,9 @@ var meResponseNestedFields = {
1378
1380
 
1379
1381
  // src/services/user/user.service.ts
1380
1382
  var createUserService = (client) => ({
1383
+ async featureTestPhase(featureName, testFeatures) {
1384
+ return testFeatures.includes(featureName);
1385
+ },
1381
1386
  async getTestFeatureEnabled(fetchFields, option) {
1382
1387
  var _a, _b;
1383
1388
  const res = await client.request(
@@ -3523,35 +3528,8 @@ var updateTransactionResponse = getTransactionResponse;
3523
3528
  var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
3524
3529
 
3525
3530
  // src/services/sales/transaction.service.ts
3526
- var createTransactionService = (client) => ({
3527
- /**
3528
- * Uploads a transaction receipt
3529
- * @param form {
3530
- * file: File;
3531
- * transactionId: string;
3532
- * storeId: string;
3533
- * }
3534
- * @returns Transaction with updated receipt URL
3535
- */
3536
- async uploadExpenseReceipt(form) {
3537
- const fileClient = createFileService(client);
3538
- return (await fileClient.uploadTxReceipt(form)).transaction;
3539
- },
3540
- async updateTransaction(input, fetchFields, option) {
3541
- var _a, _b, _c, _d;
3542
- const res = await client.request(
3543
- transactionSchema.updateTransaction(
3544
- gqlQueryStringBuilder(
3545
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3546
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3547
- )
3548
- ),
3549
- input,
3550
- option
3551
- );
3552
- return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3553
- },
3554
- async addTransaction(input, fetchFields, option) {
3531
+ var createTransactionService = (client) => {
3532
+ async function addTransaction(input, fetchFields, option) {
3555
3533
  var _a, _b, _c, _d;
3556
3534
  const res = await client.request(
3557
3535
  transactionSchema.addTransaction(
@@ -3564,98 +3542,134 @@ var createTransactionService = (client) => ({
3564
3542
  option
3565
3543
  );
3566
3544
  return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3567
- },
3568
- async addCustomerDeposit(input, fetchFields, option) {
3569
- return this.addTransaction(
3570
- {
3571
- transaction: {
3572
- ...input,
3573
- transactionType: "customerDeposit",
3574
- platform: "pos"
3575
- }
3576
- },
3577
- fetchFields,
3578
- option
3579
- );
3580
- },
3581
- async addCustomerRefund(input, fetchFields, option) {
3582
- return this.addTransaction(
3583
- {
3584
- transaction: {
3585
- ...input,
3586
- transactionType: "customerRefund",
3587
- platform: "pos"
3588
- }
3589
- },
3590
- fetchFields,
3591
- option
3592
- );
3593
- },
3594
- async getTransaction(input, fetchFields, option) {
3595
- var _a, _b, _c, _d;
3596
- const res = await client.request(
3597
- transactionSchema.getTransaction(
3598
- gqlQueryStringBuilder(
3599
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3600
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3601
- )
3602
- ),
3603
- input,
3604
- option
3605
- );
3606
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3607
- },
3608
- async getTransactions(input, fetchFields, option) {
3609
- var _a, _b, _c, _d;
3610
- const res = await client.request(
3611
- transactionSchema.getTransactions(
3612
- gqlQueryStringBuilder(
3613
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3614
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3615
- )
3616
- ),
3617
- input,
3618
- option
3619
- );
3620
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3621
3545
  }
3622
- });
3623
-
3624
- // src/services/sales/types/expense-category.type.ts
3546
+ return {
3547
+ /**
3548
+ *
3549
+ * @param input transactionRequest
3550
+ * @param fetchFields filter what is returned (fields)
3551
+ * @param option call options - cache
3552
+ * @returns TransactionResponse
3553
+ */
3554
+ async returnSales(input, fetchFields, option) {
3555
+ return addTransaction(input, fetchFields, option);
3556
+ },
3557
+ /**
3558
+ * Uploads a transaction receipt
3559
+ * @param form {
3560
+ * file: File;
3561
+ * transactionId: string;
3562
+ * storeId: string;
3563
+ * }
3564
+ * @returns Transaction with updated receipt URL
3565
+ */
3566
+ async uploadExpenseReceipt(form) {
3567
+ const fileClient = createFileService(client);
3568
+ return (await fileClient.uploadTxReceipt(form)).transaction;
3569
+ },
3570
+ async updateTransaction(input, fetchFields, option) {
3571
+ var _a, _b, _c, _d;
3572
+ const res = await client.request(
3573
+ transactionSchema.updateTransaction(
3574
+ gqlQueryStringBuilder(
3575
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3576
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3577
+ )
3578
+ ),
3579
+ input,
3580
+ option
3581
+ );
3582
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3583
+ },
3584
+ addTransaction,
3585
+ async addCustomerDeposit(input, fetchFields, option) {
3586
+ return this.addTransaction(
3587
+ {
3588
+ transaction: {
3589
+ ...input,
3590
+ transactionType: "customerDeposit",
3591
+ platform: "pos"
3592
+ }
3593
+ },
3594
+ fetchFields,
3595
+ option
3596
+ );
3597
+ },
3598
+ async addCustomerRefund(input, fetchFields, option) {
3599
+ return this.addTransaction(
3600
+ {
3601
+ transaction: {
3602
+ ...input,
3603
+ transactionType: "customerRefund",
3604
+ platform: "pos"
3605
+ }
3606
+ },
3607
+ fetchFields,
3608
+ option
3609
+ );
3610
+ },
3611
+ async getTransaction(input, fetchFields, option) {
3612
+ var _a, _b, _c, _d;
3613
+ const res = await client.request(
3614
+ transactionSchema.getTransaction(
3615
+ gqlQueryStringBuilder(
3616
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3617
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3618
+ )
3619
+ ),
3620
+ input,
3621
+ option
3622
+ );
3623
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3624
+ },
3625
+ async getTransactions(input, fetchFields, option) {
3626
+ var _a, _b, _c, _d;
3627
+ const res = await client.request(
3628
+ transactionSchema.getTransactions(
3629
+ gqlQueryStringBuilder(
3630
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3631
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3632
+ )
3633
+ ),
3634
+ input,
3635
+ option
3636
+ );
3637
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3638
+ }
3639
+ };
3640
+ };
3625
3641
  var ENTITY8 = "expenseCategory";
3626
- var expenseCategoryIntegration = createStandardEntityIntegration({
3642
+ var expenseCategoryIntegration = createStandardEntityIntegration$1({
3627
3643
  key: ENTITY8,
3628
3644
  fields: expenseCategoryQuery,
3629
3645
  nested: {
3630
3646
  features: expenseCategoryQuery
3631
3647
  }
3632
3648
  });
3633
- var expenseCategoryListIntegration = createListIntegration({
3649
+ var expenseCategoryListIntegration = createListIntegration$1({
3634
3650
  key: ENTITY8,
3635
3651
  fields: expenseCategoryQuery,
3636
3652
  nested: {
3637
3653
  features: expenseCategoryQuery
3638
3654
  }
3639
3655
  });
3640
- var expenseCategoryDeleteIntegration = createDeleteIntegration(ENTITY8);
3641
-
3642
- // src/services/sales/types/expense.type.ts
3656
+ var expenseCategoryDeleteIntegration = createDeleteIntegration$1(ENTITY8);
3643
3657
  var ENTITY9 = "expense";
3644
- var expenseIntegration = createStandardEntityIntegration({
3658
+ var expenseIntegration = createStandardEntityIntegration$1({
3645
3659
  key: ENTITY9,
3646
3660
  fields: expenseQuery,
3647
3661
  nested: {
3648
3662
  features: expenseQuery
3649
3663
  }
3650
3664
  });
3651
- var expenseListIntegration = createListIntegration({
3665
+ var expenseListIntegration = createListIntegration$1({
3652
3666
  key: ENTITY9,
3653
3667
  fields: expenseQuery,
3654
3668
  nested: {
3655
3669
  features: expenseQuery
3656
3670
  }
3657
3671
  });
3658
- var expenseDeleteIntegration = createDeleteIntegration(ENTITY9);
3672
+ var expenseDeleteIntegration = createDeleteIntegration$1(ENTITY9);
3659
3673
 
3660
3674
  // src/services/sales/schemas/expense-category.schema.ts
3661
3675
  var expenseCategorySchema = {