@connect-plus-online/ogabai-integrations 0.0.95 → 0.0.97

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
@@ -970,8 +970,9 @@ type ListEntityRequest<T, K extends EntityKey> = {
970
970
  skip: number;
971
971
  search?: string;
972
972
  };
973
+ type Pluralize<K extends string> = K extends `${infer Root}y` ? `${Root}ies` : `${K}s`;
973
974
  type ListEntityResponse<T, K extends EntityKey> = {
974
- [P in `${K}s`]: T[];
975
+ [P in Pluralize<K>]: T[];
975
976
  } & {
976
977
  total: number;
977
978
  };
@@ -1997,8 +1998,8 @@ declare const expenseCategoryIntegration: {
1997
1998
  };
1998
1999
  };
1999
2000
  declare const expenseCategoryListIntegration: {
2000
- responseFields: readonly ["expenseCategorys", "total"];
2001
- nestedFields: Record<"expenseCategorys", ExpenseCategoryFields> & {
2001
+ responseFields: readonly ["expenseCategories", "total"];
2002
+ nestedFields: Record<"expenseCategories", ExpenseCategoryFields> & {
2002
2003
  features: ExpenseCategoryFields;
2003
2004
  };
2004
2005
  };
@@ -2061,9 +2062,9 @@ declare const createExpenseCategoryService: (client: GraphQLClient) => {
2061
2062
  root?: "expenseCategoryId"[] | undefined;
2062
2063
  nestedFields?: {} | undefined;
2063
2064
  } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2064
- getExpenseCategorys: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2065
- root?: ("total" | "expenseCategorys")[] | undefined;
2066
- nestedFields?: (Record<"expenseCategorys", ExpenseCategoryFields> & {
2065
+ getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2066
+ root?: ("total" | "expenseCategories")[] | undefined;
2067
+ nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2067
2068
  features: ExpenseCategoryFields;
2068
2069
  }) | undefined;
2069
2070
  } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
@@ -2123,7 +2124,7 @@ declare const createExpenseDispenseService: (client: GraphQLClient) => {
2123
2124
  skip?: number;
2124
2125
  }) => Promise<EntityResponse<Transaction[], "transactions"> | null>;
2125
2126
  dispenseExpense: (req: {
2126
- expenseDispense: Pick<Transaction, "expenseId" | "amountPaid" | "narration" | "createdById" | "paymentType">;
2127
+ expenseDispense: Pick<Transaction, "expenseId" | "amountPaid" | "narration" | "createdById" | "paymentType" | "platform">;
2127
2128
  }) => Promise<EntityResponse<Transaction, "transaction"> | undefined>;
2128
2129
  approveExpenseDispense(req: {
2129
2130
  expenseId: string;
package/dist/index.d.ts CHANGED
@@ -970,8 +970,9 @@ type ListEntityRequest<T, K extends EntityKey> = {
970
970
  skip: number;
971
971
  search?: string;
972
972
  };
973
+ type Pluralize<K extends string> = K extends `${infer Root}y` ? `${Root}ies` : `${K}s`;
973
974
  type ListEntityResponse<T, K extends EntityKey> = {
974
- [P in `${K}s`]: T[];
975
+ [P in Pluralize<K>]: T[];
975
976
  } & {
976
977
  total: number;
977
978
  };
@@ -1997,8 +1998,8 @@ declare const expenseCategoryIntegration: {
1997
1998
  };
1998
1999
  };
1999
2000
  declare const expenseCategoryListIntegration: {
2000
- responseFields: readonly ["expenseCategorys", "total"];
2001
- nestedFields: Record<"expenseCategorys", ExpenseCategoryFields> & {
2001
+ responseFields: readonly ["expenseCategories", "total"];
2002
+ nestedFields: Record<"expenseCategories", ExpenseCategoryFields> & {
2002
2003
  features: ExpenseCategoryFields;
2003
2004
  };
2004
2005
  };
@@ -2061,9 +2062,9 @@ declare const createExpenseCategoryService: (client: GraphQLClient) => {
2061
2062
  root?: "expenseCategoryId"[] | undefined;
2062
2063
  nestedFields?: {} | undefined;
2063
2064
  } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"expenseCategory"> | undefined>;
2064
- getExpenseCategorys: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2065
- root?: ("total" | "expenseCategorys")[] | undefined;
2066
- nestedFields?: (Record<"expenseCategorys", ExpenseCategoryFields> & {
2065
+ getExpenseCategories: (input: ListEntityRequest<ExpenseCategory, "expenseCategory">, fetchFields?: {
2066
+ root?: ("total" | "expenseCategories")[] | undefined;
2067
+ nestedFields?: (Record<"expenseCategories", ExpenseCategoryFields> & {
2067
2068
  features: ExpenseCategoryFields;
2068
2069
  }) | undefined;
2069
2070
  } | undefined, option?: RequestOption) => Promise<ListEntityResponse<ExpenseCategory, "expenseCategory"> | undefined>;
@@ -2123,7 +2124,7 @@ declare const createExpenseDispenseService: (client: GraphQLClient) => {
2123
2124
  skip?: number;
2124
2125
  }) => Promise<EntityResponse<Transaction[], "transactions"> | null>;
2125
2126
  dispenseExpense: (req: {
2126
- expenseDispense: Pick<Transaction, "expenseId" | "amountPaid" | "narration" | "createdById" | "paymentType">;
2127
+ expenseDispense: Pick<Transaction, "expenseId" | "amountPaid" | "narration" | "createdById" | "paymentType" | "platform">;
2127
2128
  }) => Promise<EntityResponse<Transaction, "transaction"> | undefined>;
2128
2129
  approveExpenseDispense(req: {
2129
2130
  expenseId: string;
package/dist/index.esm.js CHANGED
@@ -544,11 +544,12 @@ function createEntityIntegration(config) {
544
544
  }
545
545
  function createListIntegration(config) {
546
546
  var _a;
547
+ const pluralKey = config.key.endsWith("y") ? `${config.key.slice(0, -1)}ies` : `${config.key}s`;
547
548
  return {
548
- responseFields: [config.key, "total"],
549
+ responseFields: [pluralKey, "total"],
549
550
  nestedFields: {
550
551
  ...(_a = config.nested) != null ? _a : {},
551
- [config.key]: config.fields
552
+ [pluralKey]: config.fields
552
553
  }
553
554
  };
554
555
  }
@@ -582,7 +583,7 @@ var userAccountIntegration = createStandardEntityIntegration({
582
583
  }
583
584
  });
584
585
  var userAccountListIntegration = createListIntegration({
585
- key: "userAccounts",
586
+ key: ENTITY,
586
587
  fields: userAccountQuery,
587
588
  nested: {
588
589
  userAccount: userAccountQuery,
@@ -728,7 +729,7 @@ var subscriptionPlanFeatureDefinitionIntegration = createStandardEntityIntegrati
728
729
  fields: subscriptionPlanFeatureDefinitionQuery
729
730
  });
730
731
  var subscriptionPlanFeatureDefinitionListIntegration = createListIntegration({
731
- key: "subscriptionPlanFeatureDefinitions",
732
+ key: ENTITY2,
732
733
  fields: subscriptionPlanFeatureDefinitionQuery
733
734
  });
734
735
  var subscriptionPlanFeatureDefinitionDeleteIntegration = createDeleteIntegration(ENTITY2);
@@ -743,7 +744,7 @@ var subscriptionPlanIntegration = createStandardEntityIntegration({
743
744
  }
744
745
  });
745
746
  var subscriptionPlanListIntegration = createListIntegration({
746
- key: "subscriptionPlans",
747
+ key: ENTITY3,
747
748
  fields: subscriptionPlanQuery,
748
749
  nested: {
749
750
  features: subscriptionPlanFeatureQuery
@@ -783,7 +784,7 @@ var subscriptionPlanFeatureBehaviourIntegration = createStandardEntityIntegratio
783
784
  fields: subscriptionPlanFeatureBehaviourQuery
784
785
  });
785
786
  var subscriptionPlanFeatureBehaviourListIntegration = createListIntegration({
786
- key: "subscriptionPlanFeatureBehaviours",
787
+ key: ENTITY4,
787
788
  fields: subscriptionPlanFeatureBehaviourQuery
788
789
  });
789
790
  var subscriptionPlanFeatureBehaviourDeleteIntegration = createDeleteIntegration(ENTITY4);
@@ -795,7 +796,7 @@ var subscriptionTrialIntegration = createStandardEntityIntegration({
795
796
  fields: subscriptionTrialQuery
796
797
  });
797
798
  var subscriptionTrialListIntegration = createListIntegration({
798
- key: "subscriptionTrials",
799
+ key: ENTITY5,
799
800
  fields: subscriptionTrialQuery
800
801
  });
801
802
  var subscriptionTrialDeleteIntegration = createDeleteIntegration(ENTITY5);
@@ -1789,7 +1790,7 @@ var userRoleIntegration = createStandardEntityIntegration({
1789
1790
  }
1790
1791
  });
1791
1792
  var userRoleListIntegration = createListIntegration({
1792
- key: "userRoles",
1793
+ key: ENTITY6,
1793
1794
  fields: userRoleQuery,
1794
1795
  nested: {
1795
1796
  privileges: privilegeQuery
@@ -1890,7 +1891,7 @@ var customerIntegration = createStandardEntityIntegration({
1890
1891
  }
1891
1892
  });
1892
1893
  var customerListIntegration = createListIntegration({
1893
- key: "customers",
1894
+ key: ENTITY7,
1894
1895
  fields: customerQuery,
1895
1896
  nested: {
1896
1897
  customerStoreBalance: customerStoreBalanceQuery
@@ -3574,7 +3575,7 @@ var expenseCategoryIntegration = createStandardEntityIntegration({
3574
3575
  }
3575
3576
  });
3576
3577
  var expenseCategoryListIntegration = createListIntegration({
3577
- key: "expenseCategorys",
3578
+ key: ENTITY8,
3578
3579
  fields: expenseCategoryQuery,
3579
3580
  nested: {
3580
3581
  features: expenseCategoryQuery
@@ -3592,7 +3593,7 @@ var expenseIntegration = createStandardEntityIntegration({
3592
3593
  }
3593
3594
  });
3594
3595
  var expenseListIntegration = createListIntegration({
3595
- key: "expenses",
3596
+ key: ENTITY9,
3596
3597
  fields: expenseQuery,
3597
3598
  nested: {
3598
3599
  features: expenseQuery
@@ -3672,7 +3673,7 @@ var createExpenseCategoryService = (client) => ({
3672
3673
  defaultNestedFields: {}
3673
3674
  }
3674
3675
  ),
3675
- getExpenseCategorys: createOperationExecutor(
3676
+ getExpenseCategories: createOperationExecutor(
3676
3677
  client,
3677
3678
  "getExpenseCategories",
3678
3679
  {
@@ -3812,7 +3813,7 @@ var createExpenseDispenseService = (client) => {
3812
3813
  });
3813
3814
  },
3814
3815
  dispenseExpense: async (req) => {
3815
- const { amountPaid, narration, createdById, expenseId, paymentType } = req.expenseDispense;
3816
+ const { amountPaid, narration, createdById, expenseId, paymentType, platform = "pos" } = req.expenseDispense;
3816
3817
  const expenseRes = await expenseService.getExpense({
3817
3818
  expense: {
3818
3819
  id: expenseId
@@ -3857,7 +3858,8 @@ var createExpenseDispenseService = (client) => {
3857
3858
  amountPaid: expense.amount,
3858
3859
  narration: expense.narration || "Approved expense dispense",
3859
3860
  createdById: expense.createdById,
3860
- paymentType: expense.paymentType
3861
+ paymentType: expense.paymentType,
3862
+ platform: "pos"
3861
3863
  }
3862
3864
  });
3863
3865
  await expenseService.updateExpense({