@connect-plus-online/ogabai-integrations 0.0.68 → 0.0.69

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.esm.js CHANGED
@@ -555,6 +555,660 @@ var userAccountListIntegration = createListIntegration({
555
555
  });
556
556
  var userAccountDeleteIntegration = createDeleteIntegration(ENTITY);
557
557
 
558
+ // src/services/subscription/schemas/paystack.schema.ts
559
+ var paystackSchema = {
560
+ paystackInitializeSubscription: (query) => `
561
+ mutation paystackInitializeSubscription($userId: String!, $planId: String!, $subscriptionFrequencyType: SubscriptionFrequencyTypeEnum!) {
562
+ paystackInitializeSubscription(userId: $userId, planId: $planId, subscriptionFrequencyType: $subscriptionFrequencyType) {
563
+ ${query}
564
+ }
565
+ }
566
+ `,
567
+ paystackInitializePayment: (query) => `
568
+ mutation paystackInitializePayment($userId: String!) {
569
+ paystackInitializePayment(userId: $userId) {
570
+ ${query}
571
+ }
572
+ }
573
+ `
574
+ };
575
+
576
+ // src/services/subscription/types/paystack.ts
577
+ var paystackInitializePaymentResponse = [
578
+ "accessCode",
579
+ "authorizationUrl",
580
+ "reference"
581
+ ];
582
+ var paystackInitializeSubscriptionResponse = paystackInitializePaymentResponse;
583
+
584
+ // src/services/subscription/paystack.service.ts
585
+ var createPaystackService = (client) => ({
586
+ async paystackInitializeSubscription(input, fetchFields, option) {
587
+ var _a, _b, _c;
588
+ const res = await client.request(
589
+ paystackSchema.paystackInitializeSubscription(
590
+ gqlQueryStringBuilder(
591
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : paystackInitializeSubscriptionResponse
592
+ )
593
+ ),
594
+ input,
595
+ option
596
+ );
597
+ return (_c = (_b = res.data) == null ? void 0 : _b.paystackInitializeSubscription) != null ? _c : null;
598
+ },
599
+ async paystackInitializePayment(input, fetchFields, option) {
600
+ var _a, _b;
601
+ const res = await client.request(
602
+ paystackSchema.paystackInitializePayment(
603
+ gqlQueryStringBuilder(
604
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : paystackInitializePaymentResponse
605
+ )
606
+ ),
607
+ input,
608
+ option
609
+ );
610
+ return (_b = res.data) == null ? void 0 : _b.paystackInitializePayment;
611
+ }
612
+ });
613
+
614
+ // src/services/subscription/subscription.entity.ts
615
+ var subscriptionPlanFeatureBehaviourQuery = [
616
+ "id",
617
+ "createdAt",
618
+ "description",
619
+ "shortname",
620
+ "subscriptionPlanFeatureKey",
621
+ "title"
622
+ ];
623
+ var subscriptionQuery = [
624
+ "cancelAtPeriodEnd",
625
+ "canceledAt",
626
+ "createdAt",
627
+ "currency",
628
+ "currentPeriodEnd",
629
+ "currentPeriodStart",
630
+ "defaultPaymentMethodId",
631
+ "id",
632
+ "price",
633
+ "subscriptionPlanId",
634
+ "subscriptionStatus",
635
+ "trialEnd",
636
+ "updatedAt",
637
+ "userId",
638
+ "version"
639
+ ];
640
+ var subscriptionPlanFeatureQuery = [
641
+ "id",
642
+ "title",
643
+ "description",
644
+ "createdAt",
645
+ "limitValue",
646
+ "accessValue",
647
+ "behaviourIds",
648
+ "subscriptionPlanFeatureKey",
649
+ "featureStatus",
650
+ "meta",
651
+ "planId"
652
+ ];
653
+ var subscriptionPlanQuery = [
654
+ "id",
655
+ "code",
656
+ "title",
657
+ "description",
658
+ "currency",
659
+ "period",
660
+ "trialDays",
661
+ "subscriptionPlanStatus",
662
+ "createdAt",
663
+ "updatedAt",
664
+ "features",
665
+ "monthlyPlanPrice",
666
+ "annuallyPlanPrice"
667
+ ];
668
+
669
+ // src/services/subscription/types/subscription-plan-feature.type.ts
670
+ var getSubscriptionPlanFeatureResponse = [
671
+ "subscriptionPlanFeature"
672
+ ];
673
+ var _getSubscriptionPlanFeatureResponseNestedFields = {};
674
+ var getSubscriptionPlanFeatureResponseNestedFields = {
675
+ ..._getSubscriptionPlanFeatureResponseNestedFields,
676
+ subscriptionPlanFeature: subscriptionPlanFeatureQuery
677
+ };
678
+ var getSubscriptionPlanFeaturesResponse = [
679
+ "subscriptionPlanFeatures",
680
+ "total"
681
+ ];
682
+ var getSubscriptionPlanFeaturesResponseNestedFields = {
683
+ ..._getSubscriptionPlanFeatureResponseNestedFields,
684
+ subscriptionPlanFeatures: subscriptionPlanFeatureQuery
685
+ };
686
+ var addSubscriptionPlanFeatureResponse = getSubscriptionPlanFeatureResponse;
687
+ var addSubscriptionPlanFeatureResponseNestedFields = getSubscriptionPlanFeatureResponseNestedFields;
688
+ var updateSubscriptionPlanFeatureResponse = getSubscriptionPlanFeatureResponse;
689
+ var updateSubscriptionPlanFeatureResponseNestedFields = getSubscriptionPlanFeatureResponseNestedFields;
690
+ var removeSubscriptionPlanFeatureResponse = [
691
+ "subscriptionPlanFeatureId"
692
+ ];
693
+
694
+ // src/services/subscription/types/subscription-plan.type.ts
695
+ var getSubscriptionPlanResponse = [
696
+ "subscriptionPlan"
697
+ ];
698
+ var _getSubscriptionPlanResponseNestedFields = {
699
+ features: subscriptionPlanFeatureQuery
700
+ };
701
+ var getSubscriptionPlanResponseNestedFields = {
702
+ ..._getSubscriptionPlanResponseNestedFields,
703
+ subscriptionPlan: subscriptionPlanQuery
704
+ };
705
+ var getSubscriptionPlansResponse = [
706
+ "subscriptionPlans",
707
+ "total"
708
+ ];
709
+ var getSubscriptionPlansResponseNestedFields = {
710
+ ..._getSubscriptionPlanResponseNestedFields,
711
+ subscriptionPlans: subscriptionPlanQuery
712
+ };
713
+ var addSubscriptionPlanResponse = getSubscriptionPlanResponse;
714
+ var addSubscriptionPlanResponseNestedFields = getSubscriptionPlanResponseNestedFields;
715
+ var updateSubscriptionPlanResponse = getSubscriptionPlanResponse;
716
+ var updateSubscriptionPlanResponseNestedFields = getSubscriptionPlanResponseNestedFields;
717
+ var removeSubscriptionPlanResponse = [
718
+ "subscriptionPlanId"
719
+ ];
720
+
721
+ // src/services/subscription/types/subscription.type.ts
722
+ var getSubscriptionResponse = [
723
+ "subscription"
724
+ ];
725
+ var _getSubscriptionResponseNestedFields = {};
726
+ var getSubscriptionResponseNestedFields = {
727
+ ..._getSubscriptionResponseNestedFields,
728
+ subscription: subscriptionQuery
729
+ };
730
+ var getSubscriptionsResponse = [
731
+ "subscriptions",
732
+ "total"
733
+ ];
734
+ var getSubscriptionsResponseNestedFields = {
735
+ ..._getSubscriptionResponseNestedFields,
736
+ subscriptions: subscriptionQuery
737
+ };
738
+ var addSubscriptionResponse = getSubscriptionResponse;
739
+ var addSubscriptionResponseNestedFields = getSubscriptionResponseNestedFields;
740
+ var updateSubscriptionResponse = getSubscriptionResponse;
741
+ var updateSubscriptionResponseNestedFields = getSubscriptionResponseNestedFields;
742
+ var removeSubscriptionResponse = [
743
+ "subscriptionId"
744
+ ];
745
+
746
+ // src/services/subscription/types/subscription-plan-feature-behaviour.type.ts
747
+ var ENTITY2 = "subscriptionPlanFeatureBehaviour";
748
+ var subscriptionPlanFeatureBehaviourIntegration = createStandardEntityIntegration({
749
+ key: ENTITY2,
750
+ fields: subscriptionPlanFeatureBehaviourQuery
751
+ });
752
+ var subscriptionPlanFeatureBehaviourListIntegration = createListIntegration({
753
+ key: "subscriptionPlanFeatureBehaviours",
754
+ fields: subscriptionPlanFeatureBehaviourQuery
755
+ });
756
+ var subscriptionPlanFeatureBehaviourDeleteIntegration = createDeleteIntegration(ENTITY2);
757
+
758
+ // src/services/subscription/schemas/subscription-plan-feature.schema.ts
759
+ var subscriptionPlanFeatureSchema = {
760
+ getSubscriptionPlanFeature: (query) => `
761
+ query getSubscriptionPlanFeature($subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
762
+ getSubscriptionPlanFeature(subscriptionPlanFeature: $subscriptionPlanFeature) {
763
+ ${query}
764
+ }
765
+ }
766
+ `,
767
+ getSubscriptionPlanFeatures: (query) => `
768
+ query getSubscriptionPlanFeatures($search: String, $subscriptionPlanFeatureIds: [String], $subscriptionPlanFeature: SubscriptionPlanFeatureInput, $limit: Int!, $skip: Int!) {
769
+ getSubscriptionPlanFeatures(search: $search, subscriptionPlanFeatureIds: $subscriptionPlanFeatureIds, subscriptionPlanFeature: $subscriptionPlanFeature, limit: $limit, skip: $skip) {
770
+ ${query}
771
+ }
772
+ }
773
+ `,
774
+ addSubscriptionPlanFeature: (query) => `
775
+ mutation addSubscriptionPlanFeature($subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
776
+ addSubscriptionPlanFeature(subscriptionPlanFeature: $subscriptionPlanFeature) {
777
+ ${query}
778
+ }
779
+ }
780
+ `,
781
+ updateSubscriptionPlanFeature: (query) => `
782
+ mutation updateSubscriptionPlanFeature($subscriptionPlanFeatureId: String!, $subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
783
+ updateSubscriptionPlanFeature(subscriptionPlanFeatureId: $subcriptionPlanFeatureId, subscriptionPlanFeature: $subscriptionPlanFeature) {
784
+ ${query}
785
+ }
786
+ }
787
+ `,
788
+ removeSubscriptionPlanFeature: (query) => `
789
+ mutation removeSubscriptionPlanFeature($subscriptionPlanFeatureId: String!) {
790
+ removeSubscriptionPlanFeature(subscriptionPlanFeatureId: $subcriptionPlanFeatureId) {
791
+ ${query}
792
+ }
793
+ }
794
+ `
795
+ };
796
+
797
+ // src/services/subscription/subscription-plan-feature.service.ts
798
+ var createSubscriptionPlanFeatureService = (client) => ({
799
+ async removeSubscriptionPlanFeature(input, fetchFields, option) {
800
+ var _a, _b, _c;
801
+ const res = await client.request(
802
+ subscriptionPlanFeatureSchema.removeSubscriptionPlanFeature(
803
+ gqlQueryStringBuilder(
804
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionPlanFeatureResponse
805
+ )
806
+ ),
807
+ input,
808
+ option
809
+ );
810
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscriptionPlanFeature) != null ? _c : null;
811
+ },
812
+ async updateSubscriptionPlanFeature(input, fetchFields, option) {
813
+ var _a, _b, _c, _d;
814
+ const res = await client.request(
815
+ subscriptionPlanFeatureSchema.updateSubscriptionPlanFeature(
816
+ gqlQueryStringBuilder(
817
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionPlanFeatureResponse,
818
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionPlanFeatureResponseNestedFields
819
+ )
820
+ ),
821
+ input,
822
+ option
823
+ );
824
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscriptionPlanFeature) != null ? _d : null;
825
+ },
826
+ async addSubscriptionPlanFeature(input, fetchFields, option) {
827
+ var _a, _b, _c, _d;
828
+ const res = await client.request(
829
+ subscriptionPlanFeatureSchema.addSubscriptionPlanFeature(
830
+ gqlQueryStringBuilder(
831
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionPlanFeatureResponse,
832
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionPlanFeatureResponseNestedFields
833
+ )
834
+ ),
835
+ input,
836
+ option
837
+ );
838
+ return (_d = (_c = res.data) == null ? void 0 : _c.addSubscriptionPlanFeature) != null ? _d : null;
839
+ },
840
+ async getSubscriptionPlanFeature(input, fetchFields, option) {
841
+ var _a, _b, _c, _d;
842
+ const res = await client.request(
843
+ subscriptionPlanFeatureSchema.getSubscriptionPlanFeature(
844
+ gqlQueryStringBuilder(
845
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanFeatureResponse,
846
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanFeatureResponseNestedFields
847
+ )
848
+ ),
849
+ input,
850
+ option
851
+ );
852
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlanFeature) != null ? _d : null;
853
+ },
854
+ async getSubscriptionPlanFeatures(input, fetchFields, option) {
855
+ var _a, _b, _c, _d;
856
+ const res = await client.request(
857
+ subscriptionPlanFeatureSchema.getSubscriptionPlanFeatures(
858
+ gqlQueryStringBuilder(
859
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanFeaturesResponse,
860
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanFeaturesResponseNestedFields
861
+ )
862
+ ),
863
+ input,
864
+ option
865
+ );
866
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlanFeatures) != null ? _d : null;
867
+ }
868
+ });
869
+
870
+ // src/services/subscription/schemas/subscription-plan.schema.ts
871
+ var subscriptionPlanSchema = {
872
+ getSubscriptionPlan: (query) => `
873
+ query getSubscriptionPlan($subscriptionPlan: SubscriptionPlanInput!) {
874
+ getSubscriptionPlan(subscriptionPlan: $subscriptionPlan) {
875
+ ${query}
876
+ }
877
+ }
878
+ `,
879
+ getSubscriptionPlans: (query) => `
880
+ query getSubscriptionPlans($search: String, $subscriptionPlanIds: [String], $subscriptionPlan: SubscriptionPlanInput, $limit: Int!, $skip: Int!) {
881
+ getSubscriptionPlans(search: $search, subscriptionPlanIds: $subscriptionPlanIds, subscriptionPlan: $subscriptionPlan, limit: $limit, skip: $skip) {
882
+ ${query}
883
+ }
884
+ }
885
+ `,
886
+ addSubscriptionPlan: (query) => `
887
+ mutation addSubscriptionPlan($subscriptionPlan: SubscriptionPlanInput!) {
888
+ addSubscriptionPlan(subscriptionPlan: $subscriptionPlan) {
889
+ ${query}
890
+ }
891
+ }
892
+ `,
893
+ updateSubscriptionPlan: (query) => `
894
+ mutation updateSubscriptionPlan($subscriptionPlanId: String!, $subscriptionPlan: SubscriptionPlanInput!) {
895
+ updateSubscriptionPlan(subscriptionPlanId: $subscriptionPlanId, subscriptionPlan: $subscriptionPlan) {
896
+ ${query}
897
+ }
898
+ }
899
+ `,
900
+ removeSubscriptionPlan: (query) => `
901
+ mutation removeSubscriptionPlan($subscriptionPlanId: String!) {
902
+ removeSubscriptionPlan(subscriptionPlanId: $subscriptionPlanId) {
903
+ ${query}
904
+ }
905
+ }
906
+ `
907
+ };
908
+
909
+ // src/services/subscription/subscription-plan.service.ts
910
+ var createSubscriptionPlanService = (client) => ({
911
+ async removeSubscriptionPlan(input, fetchFields, option) {
912
+ var _a, _b, _c;
913
+ const res = await client.request(
914
+ subscriptionPlanSchema.removeSubscriptionPlan(
915
+ gqlQueryStringBuilder(
916
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionPlanResponse
917
+ )
918
+ ),
919
+ input,
920
+ option
921
+ );
922
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscriptionPlan) != null ? _c : null;
923
+ },
924
+ async updateSubscriptionPlan(input, fetchFields, option) {
925
+ var _a, _b, _c, _d;
926
+ const res = await client.request(
927
+ subscriptionPlanSchema.updateSubscriptionPlan(
928
+ gqlQueryStringBuilder(
929
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionPlanResponse,
930
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionPlanResponseNestedFields
931
+ )
932
+ ),
933
+ input,
934
+ option
935
+ );
936
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscriptionPlan) != null ? _d : null;
937
+ },
938
+ async addSubscriptionPlan(input, fetchFields, option) {
939
+ var _a, _b, _c, _d;
940
+ const res = await client.request(
941
+ subscriptionPlanSchema.addSubscriptionPlan(
942
+ gqlQueryStringBuilder(
943
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionPlanResponse,
944
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionPlanResponseNestedFields
945
+ )
946
+ ),
947
+ input,
948
+ option
949
+ );
950
+ return (_d = (_c = res.data) == null ? void 0 : _c.addSubscriptionPlan) != null ? _d : null;
951
+ },
952
+ async getSubscriptionPlan(input, fetchFields, option) {
953
+ var _a, _b, _c, _d;
954
+ const res = await client.request(
955
+ subscriptionPlanSchema.getSubscriptionPlan(
956
+ gqlQueryStringBuilder(
957
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanResponse,
958
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanResponseNestedFields
959
+ )
960
+ ),
961
+ input,
962
+ option
963
+ );
964
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlan) != null ? _d : null;
965
+ },
966
+ async getSubscriptionPlans(input, fetchFields, option) {
967
+ var _a, _b, _c, _d;
968
+ const res = await client.request(
969
+ subscriptionPlanSchema.getSubscriptionPlans(
970
+ gqlQueryStringBuilder(
971
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlansResponse,
972
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlansResponseNestedFields
973
+ )
974
+ ),
975
+ input,
976
+ option
977
+ );
978
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlans) != null ? _d : null;
979
+ }
980
+ });
981
+
982
+ // src/services/subscription/schemas/subscription.schema.ts
983
+ var subscriptionSchema = {
984
+ getSubscription: (query) => `
985
+ query getSubscription($subscription: SubscriptionInput!) {
986
+ getSubscription(subscription: $subscription) {
987
+ ${query}
988
+ }
989
+ }
990
+ `,
991
+ getSubscriptions: (query) => `
992
+ query getSubscriptions($search: String, $subscriptionIds: [String], $subscription: SubscriptionInput, $limit: Int!, $skip: Int!) {
993
+ getSubscriptions(search: $search, subscriptionIds: $subscriptionIds, subscription: $subscription, limit: $limit, skip: $skip) {
994
+ ${query}
995
+ }
996
+ }
997
+ `,
998
+ addSubscription: (query) => `
999
+ mutation addSubscription($subscription: SubscriptionInput!) {
1000
+ addSubscription(subscription: $subscription) {
1001
+ ${query}
1002
+ }
1003
+ }
1004
+ `,
1005
+ updateSubscription: (query) => `
1006
+ mutation updateSubscription($subscriptionId: String!, $subscription: SubscriptionInput!) {
1007
+ updateSubscription(subscriptionId: $subcriptionId, subscription: $subscription) {
1008
+ ${query}
1009
+ }
1010
+ }
1011
+ `,
1012
+ removeSubscription: (query) => `
1013
+ mutation removeSubscription($subscriptionId: String!) {
1014
+ removeSubscription(subscriptionId: $subcriptionId) {
1015
+ ${query}
1016
+ }
1017
+ }
1018
+ `
1019
+ };
1020
+
1021
+ // src/services/subscription/subscription.service.ts
1022
+ var createSubscriptionService = (client) => ({
1023
+ async removeSubscription(input, fetchFields, option) {
1024
+ var _a, _b, _c;
1025
+ const res = await client.request(
1026
+ subscriptionSchema.removeSubscription(
1027
+ gqlQueryStringBuilder(
1028
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionResponse
1029
+ )
1030
+ ),
1031
+ input,
1032
+ option
1033
+ );
1034
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscription) != null ? _c : null;
1035
+ },
1036
+ async updateSubscription(input, fetchFields, option) {
1037
+ var _a, _b, _c, _d;
1038
+ const res = await client.request(
1039
+ subscriptionSchema.updateSubscription(
1040
+ gqlQueryStringBuilder(
1041
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionResponse,
1042
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionResponseNestedFields
1043
+ )
1044
+ ),
1045
+ input,
1046
+ option
1047
+ );
1048
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscription) != null ? _d : null;
1049
+ },
1050
+ async addSubscription(input, fetchFields, option) {
1051
+ var _a, _b, _c, _d;
1052
+ const res = await client.request(
1053
+ subscriptionSchema.addSubscription(
1054
+ gqlQueryStringBuilder(
1055
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionResponse,
1056
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionResponseNestedFields
1057
+ )
1058
+ ),
1059
+ input,
1060
+ option
1061
+ );
1062
+ return (_d = (_c = res.data) == null ? void 0 : _c.addSubscription) != null ? _d : null;
1063
+ },
1064
+ async getSubscription(input, fetchFields, option) {
1065
+ var _a, _b, _c, _d;
1066
+ const res = await client.request(
1067
+ subscriptionSchema.getSubscription(
1068
+ gqlQueryStringBuilder(
1069
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionResponse,
1070
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionResponseNestedFields
1071
+ )
1072
+ ),
1073
+ input,
1074
+ option
1075
+ );
1076
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscription) != null ? _d : null;
1077
+ },
1078
+ async getSubscriptions(input, fetchFields, option) {
1079
+ var _a, _b, _c, _d;
1080
+ const res = await client.request(
1081
+ subscriptionSchema.getSubscriptions(
1082
+ gqlQueryStringBuilder(
1083
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionsResponse,
1084
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionsResponseNestedFields
1085
+ )
1086
+ ),
1087
+ input,
1088
+ option
1089
+ );
1090
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptions) != null ? _d : null;
1091
+ }
1092
+ });
1093
+
1094
+ // src/helpers/service.factory.ts
1095
+ function createOperationExecutor(client, key, config) {
1096
+ return async (input, fetchFields, option) => {
1097
+ var _a, _b, _c;
1098
+ const query = config.schema(
1099
+ gqlQueryStringBuilder(
1100
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : config.defaultRootFields,
1101
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : config.defaultNestedFields
1102
+ )
1103
+ );
1104
+ const res = await client.request(
1105
+ query,
1106
+ input,
1107
+ option
1108
+ );
1109
+ return (_c = res.data) == null ? void 0 : _c[key];
1110
+ };
1111
+ }
1112
+
1113
+ // src/helpers/schema-builder.ts
1114
+ function buildSchema({
1115
+ operation,
1116
+ name,
1117
+ variables,
1118
+ field
1119
+ }) {
1120
+ return (selection) => `
1121
+ ${operation} ${name}${variables} {
1122
+ ${name}${field} {
1123
+ ${selection}
1124
+ }
1125
+ }
1126
+ `.trim();
1127
+ }
1128
+
1129
+ // src/services/subscription/schemas/subscription-plan-feature-behaviour.ts
1130
+ var subscriptionPlanFeatureBehaviourSchema = {
1131
+ get: {
1132
+ operation: "query",
1133
+ name: "getSubscriptionPlanFeatureBehaviour",
1134
+ variables: "($subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
1135
+ field: "(subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
1136
+ },
1137
+ list: {
1138
+ operation: "query",
1139
+ name: "getSubscriptionPlanFeatureBehaviours",
1140
+ variables: "($limit: Int!, $skip: Int!, $search: String, $subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput, $subscriptionPlanFeatureBehaviourIds: [String])",
1141
+ field: "(limit: $limit, skip: $skip, search: $search, subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour, subscriptionPlanFeatureBehaviourIds: $subscriptionPlanFeatureBehaviourIds)"
1142
+ },
1143
+ create: {
1144
+ operation: "mutation",
1145
+ name: "createSubscriptionPlanFeatureBehaviour",
1146
+ variables: "($subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
1147
+ field: "(subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
1148
+ },
1149
+ update: {
1150
+ operation: "mutation",
1151
+ name: "updateSubscriptionPlanFeatureBehaviour",
1152
+ variables: "($subscriptionPlanFeatureBehaviourId: String!, $subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
1153
+ field: "(subscriptionPlanFeatureBehaviourId: $subscriptionPlanFeatureBehaviourId, subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
1154
+ },
1155
+ delete: {
1156
+ operation: "mutation",
1157
+ name: "removeSubscriptionPlanFeatureBehaviour",
1158
+ variables: "($subscriptionPlanFeatureBehaviourId: String!)",
1159
+ field: "(subscriptionPlanFeatureBehaviourId: $subscriptionPlanFeatureBehaviourId)"
1160
+ }
1161
+ };
1162
+
1163
+ // src/services/subscription/subscription-plan-feature-behaviour.service.ts
1164
+ var createSubscriptionPlanFeatureBehaviourService = (client) => ({
1165
+ createSubscriptionPlanFeatureBehaviour: createOperationExecutor(
1166
+ client,
1167
+ "createSubscriptionPlanFeatureBehaviour",
1168
+ {
1169
+ schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.create),
1170
+ defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.create.responseFields,
1171
+ defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.create.nestedFields
1172
+ }
1173
+ ),
1174
+ updateSubscriptionPlanFeatureBehaviour: createOperationExecutor(
1175
+ client,
1176
+ "updateSubscriptionPlanFeatureBehaviour",
1177
+ {
1178
+ schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.update),
1179
+ defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.update.responseFields,
1180
+ defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.update.nestedFields
1181
+ }
1182
+ ),
1183
+ getSubscriptionPlanFeatureBehaviour: createOperationExecutor(
1184
+ client,
1185
+ "getSubscriptionPlanFeatureBehaviour",
1186
+ {
1187
+ schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.get),
1188
+ defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.get.responseFields,
1189
+ defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.get.nestedFields
1190
+ }
1191
+ ),
1192
+ removeSubscriptionPlanFeatureBehaviour: createOperationExecutor(
1193
+ client,
1194
+ "removeSubscriptionPlanFeatureBehaviour",
1195
+ {
1196
+ schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.delete),
1197
+ defaultRootFields: subscriptionPlanFeatureBehaviourDeleteIntegration.responseFields,
1198
+ defaultNestedFields: {}
1199
+ }
1200
+ ),
1201
+ getSubscriptionPlanFeatureBehaviours: createOperationExecutor(
1202
+ client,
1203
+ "getSubscriptionPlanFeatureBehaviours",
1204
+ {
1205
+ schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.list),
1206
+ defaultRootFields: [...subscriptionPlanFeatureBehaviourListIntegration.responseFields],
1207
+ defaultNestedFields: subscriptionPlanFeatureBehaviourListIntegration.nestedFields
1208
+ }
1209
+ )
1210
+ });
1211
+
558
1212
  // src/services/user/types/user.type.ts
559
1213
  var getUserTypeCountsResponse = [
560
1214
  "userTypeCounts"
@@ -612,12 +1266,14 @@ var meResponse = [
612
1266
  "account",
613
1267
  "stores",
614
1268
  "userSetting",
615
- "userAccounts"
1269
+ "userAccounts",
1270
+ "subscription"
616
1271
  ];
617
1272
  var meResponseNestedFields = {
618
1273
  stores: storeQuery,
619
1274
  userSetting: userSettingQuery,
620
1275
  ...userAccountListIntegration.nestedFields,
1276
+ ...getSubscriptionResponseNestedFields,
621
1277
  ...getUserResponseNestedFields,
622
1278
  ...getAccountResponseNestedFields
623
1279
  };
@@ -1004,41 +1660,6 @@ var userAccountSchema = {
1004
1660
  }
1005
1661
  };
1006
1662
 
1007
- // src/helpers/service.factory.ts
1008
- function createOperationExecutor(client, key, config) {
1009
- return async (input, fetchFields, option) => {
1010
- var _a, _b, _c;
1011
- const query = config.schema(
1012
- gqlQueryStringBuilder(
1013
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : config.defaultRootFields,
1014
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : config.defaultNestedFields
1015
- )
1016
- );
1017
- const res = await client.request(
1018
- query,
1019
- input,
1020
- option
1021
- );
1022
- return (_c = res.data) == null ? void 0 : _c[key];
1023
- };
1024
- }
1025
-
1026
- // src/helpers/schema-builder.ts
1027
- function buildSchema({
1028
- operation,
1029
- name,
1030
- variables,
1031
- field
1032
- }) {
1033
- return (selection) => `
1034
- ${operation} ${name}${variables} {
1035
- ${name}${field} {
1036
- ${selection}
1037
- }
1038
- }
1039
- `.trim();
1040
- }
1041
-
1042
1663
  // src/services/user/user-account.service.ts
1043
1664
  var createUserAccountService = (client) => ({
1044
1665
  createUserAccount: createOperationExecutor(
@@ -1089,9 +1710,9 @@ var createUserAccountService = (client) => ({
1089
1710
  });
1090
1711
 
1091
1712
  // src/services/user/types/user-role.type.ts
1092
- var ENTITY2 = "userRole";
1713
+ var ENTITY3 = "userRole";
1093
1714
  var userRoleIntegration = createStandardEntityIntegration({
1094
- key: ENTITY2,
1715
+ key: ENTITY3,
1095
1716
  fields: userRoleQuery,
1096
1717
  nested: {
1097
1718
  privileges: privilegeQuery
@@ -1104,7 +1725,7 @@ var userRoleListIntegration = createListIntegration({
1104
1725
  privileges: privilegeQuery
1105
1726
  }
1106
1727
  });
1107
- var userRoleDeleteIntegration = createDeleteIntegration(ENTITY2);
1728
+ var userRoleDeleteIntegration = createDeleteIntegration(ENTITY3);
1108
1729
 
1109
1730
  // src/services/user/schemas/user-role.schema.ts
1110
1731
  var userRoleSchema = {
@@ -1190,16 +1811,16 @@ var createUserRoleService = (client) => ({
1190
1811
  });
1191
1812
 
1192
1813
  // src/services/user/types/application-feature.type.ts
1193
- var ENTITY3 = "applicationFeature";
1814
+ var ENTITY4 = "applicationFeature";
1194
1815
  var applicationFeatureIntegration = createStandardEntityIntegration({
1195
- key: ENTITY3,
1816
+ key: ENTITY4,
1196
1817
  fields: applicationFeatureQuery
1197
1818
  });
1198
1819
  var applicationFeatureListIntegration = createListIntegration({
1199
1820
  key: "applicationFeatures",
1200
1821
  fields: applicationFeatureQuery
1201
1822
  });
1202
- var applicationFeatureDeleteIntegration = createDeleteIntegration(ENTITY3);
1823
+ var applicationFeatureDeleteIntegration = createDeleteIntegration(ENTITY4);
1203
1824
 
1204
1825
  // src/services/user/schemas/application-feature.schema.ts
1205
1826
  var applicationFeatureSchema = {
@@ -1495,1837 +2116,1225 @@ var removeStoreCategoryResponseFields = [
1495
2116
  "storeCategoryId"
1496
2117
  ];
1497
2118
 
1498
- // src/services/inventory/schema/package.schema.ts
1499
- var packageSchema = {
1500
- getPackage: (query) => `
1501
- query getPackage($productPackage: ProductPackageInput!, $template: Boolean) {
1502
- getPackage(productPackage: $productPackage, template: $template) {
1503
- ${query}
1504
- }
1505
- }
1506
- `,
1507
- getPackages: (query) => `
1508
- query getPackages($productPackage: ProductPackageInput, $packageIds: [String], $search: String, $template: Boolean, $shouldGetFromAllStores: Boolean, $limit: Int, $skip: Int) {
1509
- getPackages(productPackage: $productPackage, packageIds: $packageIds, search: $search, template: $template, shouldGetFromAllStores: $shouldGetFromAllStores, limit: $limit, skip: $skip) {
1510
- ${query}
1511
- }
1512
- }
1513
- `,
1514
- addPackage: (query) => `
1515
- mutation addPackage($productPackage: ProductPackageInput!, $template: Boolean) {
1516
- addPackage(productPackage: $productPackage, template: $template) {
1517
- ${query}
1518
- }
1519
- }
1520
- `,
1521
- addPackages: (query) => `
1522
- mutation addPackages($productPackages: [ProductPackagesInput]!, $template: Boolean) {
1523
- addPackages(productPackages: $productPackages, template: $template) {
1524
- ${query}
1525
- }
1526
- }
1527
- `,
1528
- updatePackage: (query) => `
1529
- mutation updatePackage($packageId: String!, $productPackage: ProductPackageInput!, $template: Boolean) {
1530
- updatePackage(packageId: $packageId, productPackage: $productPackage, template: $template) {
1531
- ${query}
1532
- }
1533
- }
1534
- `,
1535
- updatePackages: (query) => `
1536
- mutation updatePackages($packages: [PackagesInput]) {
1537
- updatePackages(packages: $packages) {
1538
- ${query}
1539
- }
1540
- }
1541
- `,
1542
- removePackage: (query) => `
1543
- mutation removePackage($packageId: String!, $template: Boolean) {
1544
- removePackage(packageId: $packageId, template: $template) {
1545
- ${query}
1546
- }
1547
- }
1548
- `
1549
- };
1550
-
1551
- // src/services/inventory/package.service.ts
1552
- var createPackageService = (client) => ({
1553
- async updatePackage(input, fetchFields, option) {
1554
- var _a, _b, _c, _d;
1555
- const res = await client.request(
1556
- packageSchema.updatePackage(
1557
- gqlQueryStringBuilder(
1558
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updatePackageResponseFields,
1559
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updatePackageResponseNestedFields
1560
- )
1561
- ),
1562
- input,
1563
- option
1564
- );
1565
- return (_d = (_c = res.data) == null ? void 0 : _c.updatePackage) != null ? _d : null;
1566
- },
1567
- async removePackage(input, fetchFields, option) {
1568
- var _a, _b, _c;
1569
- const res = await client.request(
1570
- packageSchema.removePackage(
1571
- gqlQueryStringBuilder(
1572
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removePackageResponseFields
1573
- )
1574
- ),
1575
- input,
1576
- option
1577
- );
1578
- return (_c = (_b = res.data) == null ? void 0 : _b.removePackage) != null ? _c : null;
1579
- },
1580
- async addPackages(input, fetchFields, option) {
1581
- var _a, _b, _c, _d;
1582
- const res = await client.request(
1583
- packageSchema.addPackages(
1584
- gqlQueryStringBuilder(
1585
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPackagesResponseFields,
1586
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPackagesResponseNestedFields
1587
- )
1588
- ),
1589
- input,
1590
- option
1591
- );
1592
- return (_d = (_c = res.data) == null ? void 0 : _c.addPackages) != null ? _d : null;
1593
- },
1594
- async addPackage(input, fetchFields, option) {
1595
- var _a, _b, _c, _d;
1596
- const res = await client.request(
1597
- packageSchema.addPackage(
1598
- gqlQueryStringBuilder(
1599
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPackageResponseFields,
1600
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPackageResponseNestedFields
1601
- )
1602
- ),
1603
- input,
1604
- option
1605
- );
1606
- return (_d = (_c = res.data) == null ? void 0 : _c.addPackage) != null ? _d : null;
1607
- },
1608
- async getPackage(input, fetchFields, option) {
1609
- var _a, _b, _c, _d;
1610
- const res = await client.request(
1611
- packageSchema.getPackage(
1612
- gqlQueryStringBuilder(
1613
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPackageResponseFields,
1614
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPackageResponseNestedFields
1615
- )
1616
- ),
1617
- input,
1618
- option
1619
- );
1620
- return (_d = (_c = res.data) == null ? void 0 : _c.getPackage) != null ? _d : null;
1621
- },
1622
- async getPackages(input, fetchFields, option) {
1623
- var _a, _b, _c, _d;
1624
- const res = await client.request(
1625
- packageSchema.getPackages(
1626
- gqlQueryStringBuilder(
1627
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPackagesResponseFields,
1628
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPackagesResponseNestedFields
1629
- )
1630
- ),
1631
- input,
1632
- option
1633
- );
1634
- return (_d = (_c = res.data) == null ? void 0 : _c.getPackages) != null ? _d : null;
1635
- }
1636
- });
1637
-
1638
- // src/services/inventory/schema/price.schema.ts
1639
- var priceSchema = {
1640
- getPrice: (query) => `
1641
- query getPrice($price: PriceInput!) {
1642
- price(price: $price) {
1643
- ${query}
1644
- }
1645
- }
1646
- `,
1647
- getPrices: (query) => `
1648
- query getPrices($price: PriceInput, $priceIds: [String], $limit: Int!, $skip: Int!) {
1649
- prices(price: $price, priceIds: $priceIds, limit: $limit, skip: $skip) {
1650
- ${query}
1651
- }
1652
- }
1653
- `,
1654
- addPrice: (mutation) => `
1655
- mutation addPrice($price: PriceInput) {
1656
- addPrice(price: $price) {
1657
- ${mutation}
1658
- }
1659
- }
1660
- `,
1661
- updatePrice: (mutation) => `
1662
- mutation updatePrice($priceId: String, $price: PriceInput) {
1663
- updatePrice(priceId: $priceId, price: $price) {
1664
- ${mutation}
1665
- }
1666
- }
1667
- `,
1668
- removePrice: (mutation) => `
1669
- mutation removePrice($priceId: String!) {
1670
- removePrice(priceId: $priceId) {
1671
- ${mutation}
1672
- }
1673
- }
1674
- `
1675
- };
1676
-
1677
- // src/services/inventory/price.service.ts
1678
- var createPriceService = (client) => ({
1679
- async updatePrice(input, fetchFields, option) {
1680
- var _a, _b, _c, _d;
1681
- const res = await client.request(
1682
- priceSchema.updatePrice(
1683
- gqlQueryStringBuilder(
1684
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updatePriceResponseFields,
1685
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updatePriceResponseNestedFields
1686
- )
1687
- ),
1688
- input,
1689
- option
1690
- );
1691
- return (_d = (_c = res.data) == null ? void 0 : _c.updatePrice) != null ? _d : null;
1692
- },
1693
- async removePrice(input, fetchFields, option) {
1694
- var _a, _b, _c;
1695
- const res = await client.request(
1696
- priceSchema.removePrice(
1697
- gqlQueryStringBuilder(
1698
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removePriceResponseFields
1699
- )
1700
- ),
1701
- input,
1702
- option
1703
- );
1704
- return (_c = (_b = res.data) == null ? void 0 : _b.removePrice) != null ? _c : null;
1705
- },
1706
- async addPrice(input, fetchFields, option) {
1707
- var _a, _b, _c, _d;
1708
- const res = await client.request(
1709
- priceSchema.addPrice(
1710
- gqlQueryStringBuilder(
1711
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPriceResponseFields,
1712
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPriceResponseNestedFields
1713
- )
1714
- ),
1715
- input,
1716
- option
1717
- );
1718
- return (_d = (_c = res.data) == null ? void 0 : _c.addPrice) != null ? _d : null;
1719
- },
1720
- async getPrice(input, fetchFields, option) {
1721
- var _a, _b, _c, _d;
1722
- const res = await client.request(
1723
- priceSchema.getPrice(
1724
- gqlQueryStringBuilder(
1725
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPriceResponseFields,
1726
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPriceResponseNestedFields
1727
- )
1728
- ),
1729
- input,
1730
- option
1731
- );
1732
- return (_d = (_c = res.data) == null ? void 0 : _c.getPrice) != null ? _d : null;
1733
- },
1734
- async getPrices(input, fetchFields, option) {
1735
- var _a, _b, _c, _d;
1736
- const res = await client.request(
1737
- priceSchema.getPrices(
1738
- gqlQueryStringBuilder(
1739
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPricesResponseFields,
1740
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPricesResponseNestedFields
1741
- )
1742
- ),
1743
- input,
1744
- option
1745
- );
1746
- return (_d = (_c = res.data) == null ? void 0 : _c.getPrices) != null ? _d : null;
1747
- }
1748
- });
1749
-
1750
- // src/services/inventory/schema/product.schema.ts
1751
- var productSchema = {
1752
- getCustomerProductCountsByIds: (query) => `
1753
- query getCustomerProductCountsByIds($userIds: [String]!) {
1754
- getCustomerProductCountsByIds(userIds: $userIds) {
2119
+ // src/services/inventory/schema/package.schema.ts
2120
+ var packageSchema = {
2121
+ getPackage: (query) => `
2122
+ query getPackage($productPackage: ProductPackageInput!, $template: Boolean) {
2123
+ getPackage(productPackage: $productPackage, template: $template) {
1755
2124
  ${query}
1756
2125
  }
1757
2126
  }
1758
2127
  `,
1759
- searchCategoriesAndTemplate: (query) => `
1760
- query searchCategoriesAndTemplate($search: String, $shouldGetFromAllStores: Boolean){
1761
- searchCategoriesAndTemplate(search: $search, shouldGetFromAllStores: $shouldGetFromAllStores) {
2128
+ getPackages: (query) => `
2129
+ query getPackages($productPackage: ProductPackageInput, $packageIds: [String], $search: String, $template: Boolean, $shouldGetFromAllStores: Boolean, $limit: Int, $skip: Int) {
2130
+ getPackages(productPackage: $productPackage, packageIds: $packageIds, search: $search, template: $template, shouldGetFromAllStores: $shouldGetFromAllStores, limit: $limit, skip: $skip) {
1762
2131
  ${query}
1763
2132
  }
1764
2133
  }
1765
2134
  `,
1766
- getProduct: (query) => `
1767
- query getProduct($product: ProductInput!, $template: Boolean) {
1768
- getProduct(product: $product, template: $template) {
2135
+ addPackage: (query) => `
2136
+ mutation addPackage($productPackage: ProductPackageInput!, $template: Boolean) {
2137
+ addPackage(productPackage: $productPackage, template: $template) {
1769
2138
  ${query}
1770
2139
  }
1771
2140
  }
1772
2141
  `,
1773
- getProducts: (query) => `
1774
- query getProducts($product: ProductInput, $productIds: [String], $search: String, $limit: Int!, $skip: Int!, $template: Boolean, $shouldGetFromAllStores: Boolean) {
1775
- getProducts(product: $product, productIds: $productIds, search: $search, limit: $limit, skip: $skip, template: $template, shouldGetFromAllStores: $shouldGetFromAllStores) {
2142
+ addPackages: (query) => `
2143
+ mutation addPackages($productPackages: [ProductPackagesInput]!, $template: Boolean) {
2144
+ addPackages(productPackages: $productPackages, template: $template) {
1776
2145
  ${query}
1777
2146
  }
1778
2147
  }
1779
2148
  `,
1780
- getProductByBarcode: (query) => `
1781
- query getProductByBarcode($barcode: String!, $fetchFromGS1IfNotFound: Boolean, $template: Boolean) {
1782
- getProductByBarcode(barcode: $barcode, fetchFromGS1IfNotFound: $fetchFromGS1IfNotFound, template: $template) {
2149
+ updatePackage: (query) => `
2150
+ mutation updatePackage($packageId: String!, $productPackage: ProductPackageInput!, $template: Boolean) {
2151
+ updatePackage(packageId: $packageId, productPackage: $productPackage, template: $template) {
1783
2152
  ${query}
1784
2153
  }
1785
2154
  }
1786
2155
  `,
1787
- searchProductNames: (query) => `
1788
- query searchProductNames($search: String!, $product: ProductInput, $limit: Int, $skip: Int, $template: Boolean) {
1789
- searchProductNames(search: $search, product: $product, limit: $limit, skip: $skip, template: $template) {
2156
+ updatePackages: (query) => `
2157
+ mutation updatePackages($packages: [PackagesInput]) {
2158
+ updatePackages(packages: $packages) {
1790
2159
  ${query}
1791
2160
  }
1792
2161
  }
1793
2162
  `,
1794
- addProduct: (mutation) => `
1795
- mutation addProduct($product: ProductInput!, $imageTypes: [String], $template: Boolean) {
1796
- addProduct(product: $product, imageTypes: $imageTypes, template: $template) {
1797
- ${mutation}
1798
- }
1799
- }
1800
- `,
1801
- updateProduct: (mutation) => `
1802
- mutation updateProduct($productId: String!, $product: ProductInput!, $template: Boolean) {
1803
- updateProduct(productId: $productId, product: $product, template: $template) {
1804
- ${mutation}
1805
- }
1806
- }
1807
- `,
1808
- removeProduct: (mutation) => `
1809
- mutation removeProduct($productId: String!, $template: Boolean) {
1810
- removeProduct(productId: $productId, template: $template) {
1811
- ${mutation}
2163
+ removePackage: (query) => `
2164
+ mutation removePackage($packageId: String!, $template: Boolean) {
2165
+ removePackage(packageId: $packageId, template: $template) {
2166
+ ${query}
1812
2167
  }
1813
2168
  }
1814
2169
  `
1815
2170
  };
1816
2171
 
1817
- // src/services/file/file.service.ts
1818
- var createFileService = (client) => ({
1819
- async uploadFile(formData) {
1820
- const url = client["url"].replace("/graphql", "") + "/api/upload";
1821
- const token = await client["tokenProvider"]();
1822
- const headers = {
1823
- ...token ? { Authorization: `Bearer ${token}` } : {}
1824
- };
1825
- const res = await fetch(url, {
1826
- method: "POST",
1827
- headers,
1828
- body: formData
1829
- // native FormData works fine
1830
- });
1831
- const text = await res.text();
1832
- if (!res.ok) throw new Error(`File upload failed: ${res.status} - ${text}`);
1833
- try {
1834
- return JSON.parse(text);
1835
- } catch (e) {
1836
- return text;
1837
- }
1838
- }
1839
- });
1840
-
1841
- // src/services/inventory/product.service.ts
1842
- var createProductService = (client) => ({
1843
- async uploadProductImage(form) {
1844
- const fileClient = createFileService(client);
1845
- return (await fileClient.uploadFile(form)).product;
1846
- },
1847
- async getCustomerProductCountsByIds(input, fetchFields, option) {
1848
- var _a, _b, _c, _d;
1849
- const res = await client.request(
1850
- productSchema.getCustomerProductCountsByIds(
1851
- gqlQueryStringBuilder(
1852
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getCustomerProductCountsByIdsResponse,
1853
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getCustomerProductCountsByIdsResponseNestedFields
1854
- )
1855
- ),
1856
- input,
1857
- option
1858
- );
1859
- return (_d = (_c = res.data) == null ? void 0 : _c.getCustomerProductCountsByIds) != null ? _d : null;
1860
- },
1861
- async searchCategoriesAndTemplate(input, fetchFields, option) {
1862
- var _a, _b, _c, _d;
1863
- const res = await client.request(
1864
- productSchema.searchCategoriesAndTemplate(
1865
- gqlQueryStringBuilder(
1866
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : searchCategoriesAndTemplateResponse,
1867
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : searchCategoriesAndTemplateResponseNestedFields
1868
- )
1869
- ),
1870
- input,
1871
- option
1872
- );
1873
- return (_d = (_c = res.data) == null ? void 0 : _c.searchCategoriesAndTemplate) != null ? _d : null;
1874
- },
1875
- async searchProductNames(input, fetchFields, option) {
1876
- var _a, _b, _c, _d;
1877
- const res = await client.request(
1878
- productSchema.searchProductNames(
1879
- gqlQueryStringBuilder(
1880
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : searchProductNamesResponse,
1881
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : searchProductNamesResponseNestedFields
1882
- )
1883
- ),
1884
- input,
1885
- option
1886
- );
1887
- return (_d = (_c = res.data) == null ? void 0 : _c.searchProductNames) != null ? _d : null;
1888
- },
1889
- async updateProduct(input, fetchFields, option) {
2172
+ // src/services/inventory/package.service.ts
2173
+ var createPackageService = (client) => ({
2174
+ async updatePackage(input, fetchFields, option) {
1890
2175
  var _a, _b, _c, _d;
1891
2176
  const res = await client.request(
1892
- productSchema.updateProduct(
2177
+ packageSchema.updatePackage(
1893
2178
  gqlQueryStringBuilder(
1894
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateProductResponseFields,
1895
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateProductResponseNestedFields
2179
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updatePackageResponseFields,
2180
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updatePackageResponseNestedFields
1896
2181
  )
1897
2182
  ),
1898
2183
  input,
1899
2184
  option
1900
2185
  );
1901
- return (_d = (_c = res.data) == null ? void 0 : _c.updateProduct) != null ? _d : null;
2186
+ return (_d = (_c = res.data) == null ? void 0 : _c.updatePackage) != null ? _d : null;
1902
2187
  },
1903
- async removeProduct(input, fetchFields, option) {
2188
+ async removePackage(input, fetchFields, option) {
1904
2189
  var _a, _b, _c;
1905
2190
  const res = await client.request(
1906
- productSchema.removeProduct(
1907
- gqlQueryStringBuilder(
1908
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeProductResponseFields
1909
- )
1910
- ),
1911
- input,
1912
- option
1913
- );
1914
- return (_c = (_b = res.data) == null ? void 0 : _b.removeProduct) != null ? _c : null;
1915
- },
1916
- async addProduct(input, fetchFields, option) {
1917
- var _a, _b, _c, _d;
1918
- const res = await client.request(
1919
- productSchema.addProduct(
1920
- gqlQueryStringBuilder(
1921
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addProductResponseFields,
1922
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addProductResponseNestedFields
1923
- )
1924
- ),
1925
- input,
1926
- option
1927
- );
1928
- return (_d = (_c = res.data) == null ? void 0 : _c.addProduct) != null ? _d : null;
1929
- },
1930
- async getProduct(input, fetchFields, option) {
1931
- var _a, _b, _c, _d;
1932
- const res = await client.request(
1933
- productSchema.getProduct(
1934
- gqlQueryStringBuilder(
1935
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getProductResponseFields,
1936
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getProductResponseNestedFields
1937
- )
1938
- ),
1939
- input,
1940
- option
1941
- );
1942
- return (_d = (_c = res.data) == null ? void 0 : _c.getProduct) != null ? _d : null;
1943
- },
1944
- async getProducts(input, fetchFields, option) {
1945
- var _a, _b, _c, _d;
1946
- const res = await client.request(
1947
- productSchema.getProducts(
1948
- gqlQueryStringBuilder(
1949
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getProductsResponseFields,
1950
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getProductsResponseNestedFields
1951
- )
1952
- ),
1953
- input,
1954
- option
1955
- );
1956
- return (_d = (_c = res.data) == null ? void 0 : _c.getProducts) != null ? _d : null;
1957
- }
1958
- });
1959
-
1960
- // src/services/inventory/schema/stock.schema.ts
1961
- var stockSchema = {
1962
- getStock: (query) => `
1963
- query getStock($stock: StockInput!) {
1964
- stock(stock: $stock) {
1965
- ${query}
1966
- }
1967
- }
1968
- `,
1969
- getStocks: (query) => `
1970
- query getStocks($stock: StockInput, $stockIds: [String], $limit: Int!, $skip: Int!) {
1971
- stocks(stock: $stock, stockIds: $stockIds, limit: $limit, skip: $skip) {
1972
- ${query}
1973
- }
1974
- }
1975
- `,
1976
- addStock: (mutation) => `
1977
- mutation addStock($stock: StockInput!) {
1978
- addStock(stock: $stock) {
1979
- ${mutation}
1980
- }
1981
- }
1982
- `,
1983
- updateStock: (mutation) => `
1984
- mutation updateStock($stockId: String!, $stock: StockInput!) {
1985
- updateStock(stockId: $stockId, stock: $stock) {
1986
- ${mutation}
1987
- }
1988
- }
1989
- `,
1990
- removeStock: (mutation) => `
1991
- mutation removeStock($stockId: String!) {
1992
- removeStock(stockId: $stockId) {
1993
- ${mutation}
1994
- }
1995
- }
1996
- `
1997
- };
1998
-
1999
- // src/services/inventory/stock.service.ts
2000
- var createStockService = (client) => ({
2001
- async updateStock(input, fetchFields, option) {
2002
- var _a, _b, _c, _d;
2003
- const res = await client.request(
2004
- stockSchema.updateStock(
2191
+ packageSchema.removePackage(
2005
2192
  gqlQueryStringBuilder(
2006
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStockResponse,
2007
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStockResponseNestedFields
2193
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removePackageResponseFields
2008
2194
  )
2009
2195
  ),
2010
2196
  input,
2011
2197
  option
2012
2198
  );
2013
- return (_d = (_c = res.data) == null ? void 0 : _c.updateStock) != null ? _d : null;
2199
+ return (_c = (_b = res.data) == null ? void 0 : _b.removePackage) != null ? _c : null;
2014
2200
  },
2015
- async removeStock(input, fetchFields, option) {
2016
- var _a, _b, _c;
2201
+ async addPackages(input, fetchFields, option) {
2202
+ var _a, _b, _c, _d;
2017
2203
  const res = await client.request(
2018
- stockSchema.removeStock(
2204
+ packageSchema.addPackages(
2019
2205
  gqlQueryStringBuilder(
2020
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStockResponse
2206
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPackagesResponseFields,
2207
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPackagesResponseNestedFields
2021
2208
  )
2022
2209
  ),
2023
2210
  input,
2024
2211
  option
2025
2212
  );
2026
- return (_c = (_b = res.data) == null ? void 0 : _b.removeStock) != null ? _c : null;
2213
+ return (_d = (_c = res.data) == null ? void 0 : _c.addPackages) != null ? _d : null;
2027
2214
  },
2028
- async addStock(input, fetchFields, option) {
2215
+ async addPackage(input, fetchFields, option) {
2029
2216
  var _a, _b, _c, _d;
2030
2217
  const res = await client.request(
2031
- stockSchema.addStock(
2218
+ packageSchema.addPackage(
2032
2219
  gqlQueryStringBuilder(
2033
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addStockResponse,
2034
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addStockResponseNestedFields
2220
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPackageResponseFields,
2221
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPackageResponseNestedFields
2035
2222
  )
2036
2223
  ),
2037
2224
  input,
2038
2225
  option
2039
2226
  );
2040
- return (_d = (_c = res.data) == null ? void 0 : _c.addStock) != null ? _d : null;
2227
+ return (_d = (_c = res.data) == null ? void 0 : _c.addPackage) != null ? _d : null;
2041
2228
  },
2042
- async getStock(input, fetchFields, option) {
2229
+ async getPackage(input, fetchFields, option) {
2043
2230
  var _a, _b, _c, _d;
2044
2231
  const res = await client.request(
2045
- stockSchema.getStock(
2232
+ packageSchema.getPackage(
2046
2233
  gqlQueryStringBuilder(
2047
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStockResponse,
2048
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStockResponseNestedFields
2234
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPackageResponseFields,
2235
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPackageResponseNestedFields
2049
2236
  )
2050
2237
  ),
2051
2238
  input,
2052
2239
  option
2053
2240
  );
2054
- return (_d = (_c = res.data) == null ? void 0 : _c.getStock) != null ? _d : null;
2241
+ return (_d = (_c = res.data) == null ? void 0 : _c.getPackage) != null ? _d : null;
2055
2242
  },
2056
- async getStocks(input, fetchFields, option) {
2243
+ async getPackages(input, fetchFields, option) {
2057
2244
  var _a, _b, _c, _d;
2058
2245
  const res = await client.request(
2059
- stockSchema.getStocks(
2246
+ packageSchema.getPackages(
2060
2247
  gqlQueryStringBuilder(
2061
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStocksResponse,
2062
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStocksResponseNestedFields
2248
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPackagesResponseFields,
2249
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPackagesResponseNestedFields
2063
2250
  )
2064
2251
  ),
2065
2252
  input,
2066
2253
  option
2067
2254
  );
2068
- return (_d = (_c = res.data) == null ? void 0 : _c.getStocks) != null ? _d : null;
2255
+ return (_d = (_c = res.data) == null ? void 0 : _c.getPackages) != null ? _d : null;
2069
2256
  }
2070
2257
  });
2071
2258
 
2072
- // src/services/inventory/schema/store.schema.ts
2073
- var storeSchema = {
2074
- getStoreCount: (query) => `
2075
- query getStoreCount($store: StoreInput!) {
2076
- getStoreCount(store: $store) {
2077
- ${query}
2078
- }
2079
- }
2080
- `,
2081
- getStore: (query) => `
2082
- query getStore($store: StoreInput!) {
2083
- getStore(store: $store) {
2259
+ // src/services/inventory/schema/price.schema.ts
2260
+ var priceSchema = {
2261
+ getPrice: (query) => `
2262
+ query getPrice($price: PriceInput!) {
2263
+ price(price: $price) {
2084
2264
  ${query}
2085
2265
  }
2086
2266
  }
2087
2267
  `,
2088
- getStores: (query) => `
2089
- query getStores($search: String, $store: StoreInput, $storeIds: [String], $limit: Int, $skip: Int) {
2090
- getStores(search: $search, store: $store, storeIds: $storeIds, limit: $limit, skip: $skip) {
2268
+ getPrices: (query) => `
2269
+ query getPrices($price: PriceInput, $priceIds: [String], $limit: Int!, $skip: Int!) {
2270
+ prices(price: $price, priceIds: $priceIds, limit: $limit, skip: $skip) {
2091
2271
  ${query}
2092
2272
  }
2093
2273
  }
2094
2274
  `,
2095
- createStore: (mutation) => `
2096
- mutation createStore($store: StoreInput) {
2097
- createStore(store: $store) {
2275
+ addPrice: (mutation) => `
2276
+ mutation addPrice($price: PriceInput) {
2277
+ addPrice(price: $price) {
2098
2278
  ${mutation}
2099
2279
  }
2100
2280
  }
2101
2281
  `,
2102
- updateStore: (mutation) => `
2103
- mutation updateStore($storeId: String, $store: StoreInput) {
2104
- updateStore(storeId: $storeId, store: $store) {
2282
+ updatePrice: (mutation) => `
2283
+ mutation updatePrice($priceId: String, $price: PriceInput) {
2284
+ updatePrice(priceId: $priceId, price: $price) {
2105
2285
  ${mutation}
2106
2286
  }
2107
2287
  }
2108
2288
  `,
2109
- deleteStore: (mutation) => `
2110
- mutation deleteStore($storeId: String) {
2111
- deleteStore(storeId: $storeId) {
2289
+ removePrice: (mutation) => `
2290
+ mutation removePrice($priceId: String!) {
2291
+ removePrice(priceId: $priceId) {
2112
2292
  ${mutation}
2113
2293
  }
2114
2294
  }
2115
2295
  `
2116
2296
  };
2117
2297
 
2118
- // src/services/inventory/store.service.ts
2119
- var createStoreService = (client) => ({
2120
- async updateStore(input, fetchFields, option) {
2298
+ // src/services/inventory/price.service.ts
2299
+ var createPriceService = (client) => ({
2300
+ async updatePrice(input, fetchFields, option) {
2121
2301
  var _a, _b, _c, _d;
2122
2302
  const res = await client.request(
2123
- storeSchema.updateStore(
2303
+ priceSchema.updatePrice(
2124
2304
  gqlQueryStringBuilder(
2125
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreResponse,
2126
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreResponseNestedFields
2305
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updatePriceResponseFields,
2306
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updatePriceResponseNestedFields
2127
2307
  )
2128
2308
  ),
2129
2309
  input,
2130
2310
  option
2131
2311
  );
2132
- return (_d = (_c = res.data) == null ? void 0 : _c.updateStore) != null ? _d : null;
2312
+ return (_d = (_c = res.data) == null ? void 0 : _c.updatePrice) != null ? _d : null;
2133
2313
  },
2134
- async removeStore(input, fetchFields, option) {
2314
+ async removePrice(input, fetchFields, option) {
2135
2315
  var _a, _b, _c;
2136
2316
  const res = await client.request(
2137
- storeSchema.deleteStore(
2317
+ priceSchema.removePrice(
2138
2318
  gqlQueryStringBuilder(
2139
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreResponse
2319
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removePriceResponseFields
2140
2320
  )
2141
2321
  ),
2142
2322
  input,
2143
2323
  option
2144
2324
  );
2145
- return (_c = (_b = res.data) == null ? void 0 : _b.deleteStore) != null ? _c : null;
2325
+ return (_c = (_b = res.data) == null ? void 0 : _b.removePrice) != null ? _c : null;
2146
2326
  },
2147
- async addStore(input, fetchFields, option) {
2327
+ async addPrice(input, fetchFields, option) {
2148
2328
  var _a, _b, _c, _d;
2149
2329
  const res = await client.request(
2150
- storeSchema.createStore(
2151
- gqlQueryStringBuilder(
2152
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addStoreResponse,
2153
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addStoreResponseNestedFields
2154
- )
2155
- ),
2156
- input,
2157
- option
2158
- );
2159
- return (_d = (_c = res.data) == null ? void 0 : _c.createStore) != null ? _d : null;
2160
- },
2161
- async getStoreCount(input, fetchFields, option) {
2162
- var _a, _b, _c;
2163
- const res = await client.request(
2164
- storeSchema.getStoreCount(
2330
+ priceSchema.addPrice(
2165
2331
  gqlQueryStringBuilder(
2166
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCountResponse
2332
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addPriceResponseFields,
2333
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addPriceResponseNestedFields
2167
2334
  )
2168
2335
  ),
2169
2336
  input,
2170
2337
  option
2171
2338
  );
2172
- return (_c = (_b = res.data) == null ? void 0 : _b.getStoreCount) != null ? _c : null;
2339
+ return (_d = (_c = res.data) == null ? void 0 : _c.addPrice) != null ? _d : null;
2173
2340
  },
2174
- async getStore(input, fetchFields, option) {
2341
+ async getPrice(input, fetchFields, option) {
2175
2342
  var _a, _b, _c, _d;
2176
2343
  const res = await client.request(
2177
- storeSchema.getStore(
2344
+ priceSchema.getPrice(
2178
2345
  gqlQueryStringBuilder(
2179
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreResponse,
2180
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreResponseNestedFields
2346
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPriceResponseFields,
2347
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPriceResponseNestedFields
2181
2348
  )
2182
2349
  ),
2183
2350
  input,
2184
2351
  option
2185
2352
  );
2186
- return (_d = (_c = res.data) == null ? void 0 : _c.getStore) != null ? _d : null;
2353
+ return (_d = (_c = res.data) == null ? void 0 : _c.getPrice) != null ? _d : null;
2187
2354
  },
2188
- async getStores(input, fetchFields, option) {
2355
+ async getPrices(input, fetchFields, option) {
2189
2356
  var _a, _b, _c, _d;
2190
2357
  const res = await client.request(
2191
- storeSchema.getStores(
2358
+ priceSchema.getPrices(
2192
2359
  gqlQueryStringBuilder(
2193
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoresResponse,
2194
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoresResponseNestedFields
2360
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getPricesResponseFields,
2361
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getPricesResponseNestedFields
2195
2362
  )
2196
2363
  ),
2197
2364
  input,
2198
2365
  option
2199
2366
  );
2200
- return (_d = (_c = res.data) == null ? void 0 : _c.getStores) != null ? _d : null;
2367
+ return (_d = (_c = res.data) == null ? void 0 : _c.getPrices) != null ? _d : null;
2201
2368
  }
2202
2369
  });
2203
2370
 
2204
- // src/services/inventory/schema/store-category.schema.ts
2205
- var storeCategorySchema = {
2206
- createStoreCategory: (query) => `
2207
- mutation createStoreCategory($storeCategory: StoreCategoryInput!) {
2208
- createStoreCategory(storeCategory: $storeCategory) {
2209
- ${query}
2210
- }
2211
- }
2212
- `,
2213
- updateStoreCategory: (query) => `
2214
- mutation updateStoreCategory($storeCategoryId: String!, $storeCategory: StoreCategoryInput!) {
2215
- updateStoreCategory(storeCategoryId: $storeCategoryId, storeCategory: $storeCategory) {
2216
- ${query}
2217
- }
2218
- }
2219
- `,
2220
- removeStoreCategory: (query) => `
2221
- mutation removeStoreCategory($storeCategoryId: String!) {
2222
- removeStoreCategory(storeCategoryId: $storeCategoryId) {
2223
- ${query}
2224
- }
2225
- }
2226
- `,
2227
- // get
2228
- getStoreCategory: (query) => `
2229
- query getStoreCategory($storeCategory: StoreCategoryInput!) {
2230
- getStoreCategory(storeCategory: $storeCategory) {
2231
- ${query}
2232
- }
2233
- }
2234
- `,
2235
- getStoreCategories: (query) => `
2236
- query getStoreCategories($search: String, $storeCategory: StoreCategoryInput, $storeCategoryIds: [String], $limit: Int!, $skip: Int!) {
2237
- getStoreCategories(search: $search, storeCategory: $storeCategory, storeCategoryIds: $storeCategoryIds, limit: $limit, skip: $skip) {
2238
- ${query}
2239
- }
2240
- }
2241
- `
2371
+ // src/services/inventory/schema/product.schema.ts
2372
+ var productSchema = {
2373
+ getCustomerProductCountsByIds: (query) => `
2374
+ query getCustomerProductCountsByIds($userIds: [String]!) {
2375
+ getCustomerProductCountsByIds(userIds: $userIds) {
2376
+ ${query}
2377
+ }
2378
+ }
2379
+ `,
2380
+ searchCategoriesAndTemplate: (query) => `
2381
+ query searchCategoriesAndTemplate($search: String, $shouldGetFromAllStores: Boolean){
2382
+ searchCategoriesAndTemplate(search: $search, shouldGetFromAllStores: $shouldGetFromAllStores) {
2383
+ ${query}
2384
+ }
2385
+ }
2386
+ `,
2387
+ getProduct: (query) => `
2388
+ query getProduct($product: ProductInput!, $template: Boolean) {
2389
+ getProduct(product: $product, template: $template) {
2390
+ ${query}
2391
+ }
2392
+ }
2393
+ `,
2394
+ getProducts: (query) => `
2395
+ query getProducts($product: ProductInput, $productIds: [String], $search: String, $limit: Int!, $skip: Int!, $template: Boolean, $shouldGetFromAllStores: Boolean) {
2396
+ getProducts(product: $product, productIds: $productIds, search: $search, limit: $limit, skip: $skip, template: $template, shouldGetFromAllStores: $shouldGetFromAllStores) {
2397
+ ${query}
2398
+ }
2399
+ }
2400
+ `,
2401
+ getProductByBarcode: (query) => `
2402
+ query getProductByBarcode($barcode: String!, $fetchFromGS1IfNotFound: Boolean, $template: Boolean) {
2403
+ getProductByBarcode(barcode: $barcode, fetchFromGS1IfNotFound: $fetchFromGS1IfNotFound, template: $template) {
2404
+ ${query}
2405
+ }
2406
+ }
2407
+ `,
2408
+ searchProductNames: (query) => `
2409
+ query searchProductNames($search: String!, $product: ProductInput, $limit: Int, $skip: Int, $template: Boolean) {
2410
+ searchProductNames(search: $search, product: $product, limit: $limit, skip: $skip, template: $template) {
2411
+ ${query}
2412
+ }
2413
+ }
2414
+ `,
2415
+ addProduct: (mutation) => `
2416
+ mutation addProduct($product: ProductInput!, $imageTypes: [String], $template: Boolean) {
2417
+ addProduct(product: $product, imageTypes: $imageTypes, template: $template) {
2418
+ ${mutation}
2419
+ }
2420
+ }
2421
+ `,
2422
+ updateProduct: (mutation) => `
2423
+ mutation updateProduct($productId: String!, $product: ProductInput!, $template: Boolean) {
2424
+ updateProduct(productId: $productId, product: $product, template: $template) {
2425
+ ${mutation}
2426
+ }
2427
+ }
2428
+ `,
2429
+ removeProduct: (mutation) => `
2430
+ mutation removeProduct($productId: String!, $template: Boolean) {
2431
+ removeProduct(productId: $productId, template: $template) {
2432
+ ${mutation}
2433
+ }
2434
+ }
2435
+ `
2242
2436
  };
2243
2437
 
2244
- // src/services/inventory/store-category.service.ts
2245
- var createStoreCategoryService = (client) => ({
2246
- async getStoreCategories(input, fetchFields, option) {
2438
+ // src/services/file/file.service.ts
2439
+ var createFileService = (client) => ({
2440
+ async uploadFile(formData) {
2441
+ const url = client["url"].replace("/graphql", "") + "/api/upload";
2442
+ const token = await client["tokenProvider"]();
2443
+ const headers = {
2444
+ ...token ? { Authorization: `Bearer ${token}` } : {}
2445
+ };
2446
+ const res = await fetch(url, {
2447
+ method: "POST",
2448
+ headers,
2449
+ body: formData
2450
+ // native FormData works fine
2451
+ });
2452
+ const text = await res.text();
2453
+ if (!res.ok) throw new Error(`File upload failed: ${res.status} - ${text}`);
2454
+ try {
2455
+ return JSON.parse(text);
2456
+ } catch (e) {
2457
+ return text;
2458
+ }
2459
+ }
2460
+ });
2461
+
2462
+ // src/services/inventory/product.service.ts
2463
+ var createProductService = (client) => ({
2464
+ async uploadProductImage(form) {
2465
+ const fileClient = createFileService(client);
2466
+ return (await fileClient.uploadFile(form)).product;
2467
+ },
2468
+ async getCustomerProductCountsByIds(input, fetchFields, option) {
2247
2469
  var _a, _b, _c, _d;
2248
2470
  const res = await client.request(
2249
- storeCategorySchema.getStoreCategories(
2471
+ productSchema.getCustomerProductCountsByIds(
2250
2472
  gqlQueryStringBuilder(
2251
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoriesResponseFields,
2252
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoriesResponseNestedFields
2473
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getCustomerProductCountsByIdsResponse,
2474
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getCustomerProductCountsByIdsResponseNestedFields
2253
2475
  )
2254
2476
  ),
2255
2477
  input,
2256
2478
  option
2257
2479
  );
2258
- return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategories) != null ? _d : null;
2480
+ return (_d = (_c = res.data) == null ? void 0 : _c.getCustomerProductCountsByIds) != null ? _d : null;
2259
2481
  },
2260
- async getStoreCategory(input, fetchFields, option) {
2482
+ async searchCategoriesAndTemplate(input, fetchFields, option) {
2261
2483
  var _a, _b, _c, _d;
2262
2484
  const res = await client.request(
2263
- storeCategorySchema.getStoreCategory(
2485
+ productSchema.searchCategoriesAndTemplate(
2264
2486
  gqlQueryStringBuilder(
2265
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryResponseFields,
2266
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryResponseNestedFields
2487
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : searchCategoriesAndTemplateResponse,
2488
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : searchCategoriesAndTemplateResponseNestedFields
2267
2489
  )
2268
2490
  ),
2269
2491
  input,
2270
2492
  option
2271
2493
  );
2272
- return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategory) != null ? _d : null;
2494
+ return (_d = (_c = res.data) == null ? void 0 : _c.searchCategoriesAndTemplate) != null ? _d : null;
2273
2495
  },
2274
- async updateStoreCategory(input, fetchFields, option) {
2496
+ async searchProductNames(input, fetchFields, option) {
2275
2497
  var _a, _b, _c, _d;
2276
2498
  const res = await client.request(
2277
- storeCategorySchema.updateStoreCategory(
2499
+ productSchema.searchProductNames(
2278
2500
  gqlQueryStringBuilder(
2279
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreCategoryResponseFields,
2280
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreCategoryResponseNestedFields
2501
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : searchProductNamesResponse,
2502
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : searchProductNamesResponseNestedFields
2281
2503
  )
2282
2504
  ),
2283
2505
  input,
2284
2506
  option
2285
2507
  );
2286
- return (_d = (_c = res.data) == null ? void 0 : _c.updateStoreCategory) != null ? _d : null;
2508
+ return (_d = (_c = res.data) == null ? void 0 : _c.searchProductNames) != null ? _d : null;
2287
2509
  },
2288
- async createStoreCategory(input, fetchFields, option) {
2510
+ async updateProduct(input, fetchFields, option) {
2289
2511
  var _a, _b, _c, _d;
2290
2512
  const res = await client.request(
2291
- storeCategorySchema.createStoreCategory(
2513
+ productSchema.updateProduct(
2292
2514
  gqlQueryStringBuilder(
2293
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createStoreCategoryResponseFields,
2294
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : createStoreCategoryResponseNestedFields
2515
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateProductResponseFields,
2516
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateProductResponseNestedFields
2295
2517
  )
2296
2518
  ),
2297
2519
  input,
2298
2520
  option
2299
2521
  );
2300
- return (_d = (_c = res.data) == null ? void 0 : _c.createStoreCategory) != null ? _d : null;
2522
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateProduct) != null ? _d : null;
2301
2523
  },
2302
- async removeStoreCategory(input, fetchFields, option) {
2524
+ async removeProduct(input, fetchFields, option) {
2303
2525
  var _a, _b, _c;
2304
2526
  const res = await client.request(
2305
- storeCategorySchema.removeStoreCategory(
2306
- gqlQueryStringBuilder(
2307
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreCategoryResponseFields
2308
- )
2309
- ),
2310
- input,
2311
- option
2312
- );
2313
- return (_c = (_b = res.data) == null ? void 0 : _b.removeStoreCategory) != null ? _c : null;
2314
- }
2315
- });
2316
-
2317
- // src/services/inventory/schema/store-category-product.schema.ts
2318
- var storeCategoryProductSchema = {
2319
- createStoreCategoryProduct: (query) => `
2320
- mutation createStoreCategoryProduct($storeCategoryProduct: StoreCategoryProductInput!) {
2321
- createStoreCategoryProduct(storeCategoryProduct: $storeCategoryProduct) {
2322
- ${query}
2323
- }
2324
- }
2325
- `,
2326
- updateStoreCategoryProduct: (query) => `
2327
- mutation updateStoreCategoryProduct($storeCategoryProductId: String!, $storeCategoryProduct: StoreCategoryProductInput!) {
2328
- updateStoreCategoryProduct(storeCategoryProductId: $storeCategoryProductId, storeCategoryProduct: $storeCategoryProduct) {
2329
- ${query}
2330
- }
2331
- }
2332
- `,
2333
- removeStoreCategoryProduct: (query) => `
2334
- mutation removeStoreCategoryProduct($storeCategoryProductId: String!) {
2335
- removeStoreCategoryProduct(storeCategoryProductId: $storeCategoryProductId) {
2336
- ${query}
2337
- }
2338
- }
2339
- `,
2340
- // get
2341
- getStoreCategoryProduct: (query) => `
2342
- query getStoreCategoryProduct($storeCategoryProduct: StoreCategoryProductInput!) {
2343
- getStoreCategoryProduct(storeCategoryProduct: $storeCategoryProduct) {
2344
- ${query}
2345
- }
2346
- }
2347
- `,
2348
- getStoreCategoryProducts: (query) => `
2349
- query getStoreCategoryProducts($search: String, $storeCategoryProduct: StoreCategoryProductInput, $storeCategoryProductIds: [String], $limit: Int!, $skip: Int!) {
2350
- getStoreCategoryProducts(search: $search, storeCategoryProduct: $storeCategoryProduct, storeCategoryProductIds: $storeCategoryProductIds, limit: $limit, skip: $skip) {
2351
- ${query}
2352
- }
2353
- }
2354
- `
2355
- };
2356
-
2357
- // src/services/inventory/store-category-product.service.ts
2358
- var createStoreCategoryProductService = (client) => ({
2359
- async getStoreCategoryProducts(input, fetchFields, option) {
2360
- var _a, _b, _c, _d;
2361
- const res = await client.request(
2362
- storeCategoryProductSchema.getStoreCategoryProducts(
2527
+ productSchema.removeProduct(
2363
2528
  gqlQueryStringBuilder(
2364
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryProductsResponseFields,
2365
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryProductsResponseNestedFields
2529
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeProductResponseFields
2366
2530
  )
2367
2531
  ),
2368
2532
  input,
2369
2533
  option
2370
2534
  );
2371
- return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategoryProducts) != null ? _d : null;
2535
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeProduct) != null ? _c : null;
2372
2536
  },
2373
- async getStoreCategoryProduct(input, fetchFields, option) {
2537
+ async addProduct(input, fetchFields, option) {
2374
2538
  var _a, _b, _c, _d;
2375
2539
  const res = await client.request(
2376
- storeCategoryProductSchema.getStoreCategoryProduct(
2540
+ productSchema.addProduct(
2377
2541
  gqlQueryStringBuilder(
2378
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryProductResponseFields,
2379
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryProductResponseNestedFields
2542
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addProductResponseFields,
2543
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addProductResponseNestedFields
2380
2544
  )
2381
2545
  ),
2382
2546
  input,
2383
2547
  option
2384
2548
  );
2385
- return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategoryProduct) != null ? _d : null;
2549
+ return (_d = (_c = res.data) == null ? void 0 : _c.addProduct) != null ? _d : null;
2386
2550
  },
2387
- async updateStoreCategoryProduct(input, fetchFields, option) {
2551
+ async getProduct(input, fetchFields, option) {
2388
2552
  var _a, _b, _c, _d;
2389
2553
  const res = await client.request(
2390
- storeCategoryProductSchema.updateStoreCategoryProduct(
2554
+ productSchema.getProduct(
2391
2555
  gqlQueryStringBuilder(
2392
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreCategoryProductResponseFields,
2393
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreCategoryProductResponseNestedFields
2556
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getProductResponseFields,
2557
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getProductResponseNestedFields
2394
2558
  )
2395
2559
  ),
2396
2560
  input,
2397
2561
  option
2398
2562
  );
2399
- return (_d = (_c = res.data) == null ? void 0 : _c.updateStoreCategoryProduct) != null ? _d : null;
2563
+ return (_d = (_c = res.data) == null ? void 0 : _c.getProduct) != null ? _d : null;
2400
2564
  },
2401
- async createStoreCategoryProduct(input, fetchFields, option) {
2565
+ async getProducts(input, fetchFields, option) {
2402
2566
  var _a, _b, _c, _d;
2403
2567
  const res = await client.request(
2404
- storeCategoryProductSchema.createStoreCategoryProduct(
2405
- gqlQueryStringBuilder(
2406
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createStoreCategoryProductResponseFields,
2407
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : createStoreCategoryProductResponseNestedFields
2408
- )
2409
- ),
2410
- input,
2411
- option
2412
- );
2413
- return (_d = (_c = res.data) == null ? void 0 : _c.createStoreCategoryProduct) != null ? _d : null;
2414
- },
2415
- async removeStoreCategoryProduct(input, fetchFields, option) {
2416
- var _a, _b, _c;
2417
- const res = await client.request(
2418
- storeCategoryProductSchema.removeStoreCategoryProduct(
2568
+ productSchema.getProducts(
2419
2569
  gqlQueryStringBuilder(
2420
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreCategoryProductResponseFields
2570
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getProductsResponseFields,
2571
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getProductsResponseNestedFields
2421
2572
  )
2422
2573
  ),
2423
2574
  input,
2424
2575
  option
2425
2576
  );
2426
- return (_c = (_b = res.data) == null ? void 0 : _b.removeStoreCategoryProduct) != null ? _c : null;
2577
+ return (_d = (_c = res.data) == null ? void 0 : _c.getProducts) != null ? _d : null;
2427
2578
  }
2428
2579
  });
2429
2580
 
2430
- // src/services/sales/schemas/order.schema.ts
2431
- var orderSchema = {
2432
- getOrder: (query) => `
2433
- query getOrder($order: OrderInput) {
2434
- getOrder(order: $order){
2435
- ${query}
2436
- }
2437
- }
2438
- `,
2439
- getOrders: (query) => `
2440
- query getOrders($orderIds: [String], $order: OrderInput, $limit: Int, $skip: Int){
2441
- getOrders(orderIds: $orderIds, order: $order, limit: $limit, skip: $skip){
2442
- ${query}
2443
- }
2444
- }
2445
- `
2446
- };
2447
-
2448
- // src/services/sales/sale.entity.ts
2449
- var transactionQuery = [
2450
- "_id",
2451
- "amountPaid",
2452
- "amountTotal",
2453
- "createdAt",
2454
- "from",
2455
- "fromWallet",
2456
- "isCredit",
2457
- "paymentDate",
2458
- "paymentType",
2459
- "platform",
2460
- "saleIds",
2461
- "saleStatus",
2462
- "sales",
2463
- "storeId",
2464
- "to",
2465
- "toWallet",
2466
- "txStatus"
2467
- ];
2468
- var orderQuery = [
2469
- "_id",
2470
- "createdAt",
2471
- "orderStatus",
2472
- "transactionId",
2473
- "userId"
2474
- ];
2475
- var saleQuery = [
2476
- "_id",
2477
- "amountTotal",
2478
- "createdAt",
2479
- "packageId",
2480
- "productId",
2481
- "quantity",
2482
- "storeId"
2483
- ];
2484
-
2485
- // src/services/sales/types/order.type.ts
2486
- var getOrderResponse = ["order"];
2487
- var getOrderResponseNestedFields = {
2488
- order: orderQuery
2489
- };
2490
- var getOrdersResponse = ["orders"];
2491
- var getOrdersResponseNestedFields = {
2492
- orders: orderQuery
2581
+ // src/services/inventory/schema/stock.schema.ts
2582
+ var stockSchema = {
2583
+ getStock: (query) => `
2584
+ query getStock($stock: StockInput!) {
2585
+ stock(stock: $stock) {
2586
+ ${query}
2587
+ }
2588
+ }
2589
+ `,
2590
+ getStocks: (query) => `
2591
+ query getStocks($stock: StockInput, $stockIds: [String], $limit: Int!, $skip: Int!) {
2592
+ stocks(stock: $stock, stockIds: $stockIds, limit: $limit, skip: $skip) {
2593
+ ${query}
2594
+ }
2595
+ }
2596
+ `,
2597
+ addStock: (mutation) => `
2598
+ mutation addStock($stock: StockInput!) {
2599
+ addStock(stock: $stock) {
2600
+ ${mutation}
2601
+ }
2602
+ }
2603
+ `,
2604
+ updateStock: (mutation) => `
2605
+ mutation updateStock($stockId: String!, $stock: StockInput!) {
2606
+ updateStock(stockId: $stockId, stock: $stock) {
2607
+ ${mutation}
2608
+ }
2609
+ }
2610
+ `,
2611
+ removeStock: (mutation) => `
2612
+ mutation removeStock($stockId: String!) {
2613
+ removeStock(stockId: $stockId) {
2614
+ ${mutation}
2615
+ }
2616
+ }
2617
+ `
2493
2618
  };
2494
2619
 
2495
- // src/services/sales/order.service.ts
2496
- var createOrderService = (client) => ({
2497
- async getOrder(input, fetchFields, option) {
2620
+ // src/services/inventory/stock.service.ts
2621
+ var createStockService = (client) => ({
2622
+ async updateStock(input, fetchFields, option) {
2498
2623
  var _a, _b, _c, _d;
2499
2624
  const res = await client.request(
2500
- orderSchema.getOrder(
2625
+ stockSchema.updateStock(
2501
2626
  gqlQueryStringBuilder(
2502
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getOrderResponse,
2503
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getOrderResponseNestedFields
2627
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStockResponse,
2628
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStockResponseNestedFields
2504
2629
  )
2505
2630
  ),
2506
2631
  input,
2507
2632
  option
2508
2633
  );
2509
- return (_d = (_c = res.data) == null ? void 0 : _c.getOrder) != null ? _d : null;
2634
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateStock) != null ? _d : null;
2510
2635
  },
2511
- async getOrders(input, fetchFields, option) {
2636
+ async removeStock(input, fetchFields, option) {
2637
+ var _a, _b, _c;
2638
+ const res = await client.request(
2639
+ stockSchema.removeStock(
2640
+ gqlQueryStringBuilder(
2641
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStockResponse
2642
+ )
2643
+ ),
2644
+ input,
2645
+ option
2646
+ );
2647
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeStock) != null ? _c : null;
2648
+ },
2649
+ async addStock(input, fetchFields, option) {
2512
2650
  var _a, _b, _c, _d;
2513
2651
  const res = await client.request(
2514
- orderSchema.getOrders(
2652
+ stockSchema.addStock(
2515
2653
  gqlQueryStringBuilder(
2516
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getOrdersResponse,
2517
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getOrdersResponseNestedFields
2654
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addStockResponse,
2655
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addStockResponseNestedFields
2518
2656
  )
2519
2657
  ),
2520
2658
  input,
2521
2659
  option
2522
2660
  );
2523
- return (_d = (_c = res.data) == null ? void 0 : _c.getOrders) != null ? _d : null;
2524
- }
2525
- });
2526
-
2527
- // src/services/sales/schemas/sale.schema.ts
2528
- var saleSchema = {
2529
- getSales: (query) => `
2530
- query getSales($saleIds: [String], $saleFilter: SaleFilterInput, $ShouldGetFromAllStores: Boolean, $dateFilter: DateFilterInput, $limit: Int, $skip: Int) {
2531
- getSales(saleIds: $saleIds, saleFilter: $saleFilter, ShouldGetFromAllStores: $ShouldGetFromAllStores, dateFilter: $dateFilter, limit: $limit, skip: $skip) {
2532
- ${query}
2533
- }
2534
- }
2535
- `,
2536
- updateSale: (query) => `
2537
- mutation updateSale($saleId: String!, $sale: SaleInput!) {
2538
- updateSale(saleId: $saleId, sale: $sale) {
2539
- ${query}
2540
- }
2541
- }
2542
- `
2543
- };
2544
-
2545
- // src/services/sales/types/sale.type.ts
2546
- var getSaleResponse = ["sale"];
2547
- var _getSaleResponseNestedFields = {
2548
- ..._getProductResponseNestedFields
2549
- };
2550
- var getSaleResponseNestedFields = {
2551
- sale: saleQuery,
2552
- ..._getSaleResponseNestedFields
2553
- };
2554
- var getSalesResponse = [
2555
- "sales",
2556
- "uniqueProducts"
2557
- ];
2558
- var getSalesResponseNestedFields = {
2559
- sales: saleQuery,
2560
- uniqueProducts: productQuery,
2561
- ..._getSaleResponseNestedFields
2562
- };
2563
- var UpdateSaleResponse = ["sale"];
2564
- var updateSaleResponseNestedFields = getSaleResponseNestedFields;
2565
-
2566
- // src/services/sales/sale.service.ts
2567
- var createSaleService = (client) => ({
2568
- async updateSale(input, fetchFields, option) {
2661
+ return (_d = (_c = res.data) == null ? void 0 : _c.addStock) != null ? _d : null;
2662
+ },
2663
+ async getStock(input, fetchFields, option) {
2569
2664
  var _a, _b, _c, _d;
2570
2665
  const res = await client.request(
2571
- saleSchema.updateSale(
2666
+ stockSchema.getStock(
2572
2667
  gqlQueryStringBuilder(
2573
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : UpdateSaleResponse,
2574
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSaleResponseNestedFields
2668
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStockResponse,
2669
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStockResponseNestedFields
2575
2670
  )
2576
2671
  ),
2577
2672
  input,
2578
2673
  option
2579
2674
  );
2580
- return (_d = (_c = res.data) == null ? void 0 : _c.updateSale) != null ? _d : null;
2675
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStock) != null ? _d : null;
2581
2676
  },
2582
- async getSales(input, fetchFields, option) {
2677
+ async getStocks(input, fetchFields, option) {
2583
2678
  var _a, _b, _c, _d;
2584
2679
  const res = await client.request(
2585
- saleSchema.getSales(
2680
+ stockSchema.getStocks(
2586
2681
  gqlQueryStringBuilder(
2587
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSalesResponse,
2588
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSalesResponseNestedFields
2682
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStocksResponse,
2683
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStocksResponseNestedFields
2589
2684
  )
2590
2685
  ),
2591
2686
  input,
2592
2687
  option
2593
2688
  );
2594
- return (_d = (_c = res.data) == null ? void 0 : _c.getSales) != null ? _d : null;
2689
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStocks) != null ? _d : null;
2595
2690
  }
2596
2691
  });
2597
2692
 
2598
- // src/services/sales/schemas/transaction.schema.ts
2599
- var transactionSchema = {
2600
- getTransaction: (query) => `
2601
- query getTransaction($transaction: TransactionInput!){
2602
- getTransaction(transaction: $transaction){
2603
- ${query}
2604
- }
2605
- }
2606
- `,
2607
- getTransactions: (query) => `
2608
- query getTransactions($dateFilter: DateFilterInput, $transactionIds: [String], $transaction: TransactionInput, $limit: Int, $skip: Int, $shouldGetFromAllStores: Boolean){
2609
- getTransactions(dateFilter: $dateFilter, transactionIds: $transactionIds, transaction: $transaction, limit: $limit, skip: $skip, shouldGetFromAllStores: $shouldGetFromAllStores){
2610
- ${query}
2611
- }
2612
- }
2613
- `,
2614
- addTransaction: (query) => `
2615
- mutation addTransaction($transaction: TransactionInput!){
2616
- addTransaction(transaction: $transaction){
2617
- ${query}
2618
- }
2619
- }
2620
- `,
2621
- updateTransaction: (query) => `
2622
- mutation updateTransaction($transactionId: String!, $transaction: TransactionInput!){
2623
- updateTransaction(transactionId: $transactionId, transaction: $transaction){
2624
- ${query}
2625
- }
2626
- }
2627
- `
2628
- };
2629
-
2630
- // src/services/sales/types/transaction.type.ts
2631
- var getTransactionResponse = [
2632
- "transaction"
2633
- ];
2634
- var _getTransactionResponseNestedFields = {
2635
- sales: saleQuery
2636
- };
2637
- var getTransactionResponseNestedFields = {
2638
- transaction: transactionQuery,
2639
- ..._getTransactionResponseNestedFields
2640
- };
2641
- var getTransactionsResponse = [
2642
- "transactions",
2643
- "uniqueProducts"
2644
- ];
2645
- var _getTransactionsResponseNestedFields = {
2646
- sales: saleQuery,
2647
- uniqueProducts: productNameQuery,
2648
- ..._getProductResponseNestedFields
2649
- };
2650
- var getTransactionsResponseNestedFields = {
2651
- transactions: transactionQuery,
2652
- ..._getTransactionsResponseNestedFields
2693
+ // src/services/inventory/schema/store.schema.ts
2694
+ var storeSchema = {
2695
+ getStoreCount: (query) => `
2696
+ query getStoreCount($store: StoreInput!) {
2697
+ getStoreCount(store: $store) {
2698
+ ${query}
2699
+ }
2700
+ }
2701
+ `,
2702
+ getStore: (query) => `
2703
+ query getStore($store: StoreInput!) {
2704
+ getStore(store: $store) {
2705
+ ${query}
2706
+ }
2707
+ }
2708
+ `,
2709
+ getStores: (query) => `
2710
+ query getStores($search: String, $store: StoreInput, $storeIds: [String], $limit: Int, $skip: Int) {
2711
+ getStores(search: $search, store: $store, storeIds: $storeIds, limit: $limit, skip: $skip) {
2712
+ ${query}
2713
+ }
2714
+ }
2715
+ `,
2716
+ createStore: (mutation) => `
2717
+ mutation createStore($store: StoreInput) {
2718
+ createStore(store: $store) {
2719
+ ${mutation}
2720
+ }
2721
+ }
2722
+ `,
2723
+ updateStore: (mutation) => `
2724
+ mutation updateStore($storeId: String, $store: StoreInput) {
2725
+ updateStore(storeId: $storeId, store: $store) {
2726
+ ${mutation}
2727
+ }
2728
+ }
2729
+ `,
2730
+ deleteStore: (mutation) => `
2731
+ mutation deleteStore($storeId: String) {
2732
+ deleteStore(storeId: $storeId) {
2733
+ ${mutation}
2734
+ }
2735
+ }
2736
+ `
2653
2737
  };
2654
- var addTransactionResponse = getTransactionResponse;
2655
- var addTransactionResponseNestedFields = getTransactionResponseNestedFields;
2656
- var updateTransactionResponse = getTransactionResponse;
2657
- var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
2658
2738
 
2659
- // src/services/sales/transaction.service.ts
2660
- var createTransactionService = (client) => ({
2661
- async updateTransaction(input, fetchFields, option) {
2739
+ // src/services/inventory/store.service.ts
2740
+ var createStoreService = (client) => ({
2741
+ async updateStore(input, fetchFields, option) {
2662
2742
  var _a, _b, _c, _d;
2663
2743
  const res = await client.request(
2664
- transactionSchema.updateTransaction(
2744
+ storeSchema.updateStore(
2745
+ gqlQueryStringBuilder(
2746
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreResponse,
2747
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreResponseNestedFields
2748
+ )
2749
+ ),
2750
+ input,
2751
+ option
2752
+ );
2753
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateStore) != null ? _d : null;
2754
+ },
2755
+ async removeStore(input, fetchFields, option) {
2756
+ var _a, _b, _c;
2757
+ const res = await client.request(
2758
+ storeSchema.deleteStore(
2759
+ gqlQueryStringBuilder(
2760
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreResponse
2761
+ )
2762
+ ),
2763
+ input,
2764
+ option
2765
+ );
2766
+ return (_c = (_b = res.data) == null ? void 0 : _b.deleteStore) != null ? _c : null;
2767
+ },
2768
+ async addStore(input, fetchFields, option) {
2769
+ var _a, _b, _c, _d;
2770
+ const res = await client.request(
2771
+ storeSchema.createStore(
2665
2772
  gqlQueryStringBuilder(
2666
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
2667
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
2773
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addStoreResponse,
2774
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addStoreResponseNestedFields
2668
2775
  )
2669
2776
  ),
2670
2777
  input,
2671
2778
  option
2672
2779
  );
2673
- return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
2780
+ return (_d = (_c = res.data) == null ? void 0 : _c.createStore) != null ? _d : null;
2674
2781
  },
2675
- async addTransaction(input, fetchFields, option) {
2676
- var _a, _b, _c, _d;
2782
+ async getStoreCount(input, fetchFields, option) {
2783
+ var _a, _b, _c;
2677
2784
  const res = await client.request(
2678
- transactionSchema.addTransaction(
2785
+ storeSchema.getStoreCount(
2679
2786
  gqlQueryStringBuilder(
2680
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addTransactionResponse,
2681
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addTransactionResponseNestedFields
2787
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCountResponse
2682
2788
  )
2683
2789
  ),
2684
2790
  input,
2685
2791
  option
2686
2792
  );
2687
- return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
2793
+ return (_c = (_b = res.data) == null ? void 0 : _b.getStoreCount) != null ? _c : null;
2688
2794
  },
2689
- async getTransaction(input, fetchFields, option) {
2795
+ async getStore(input, fetchFields, option) {
2690
2796
  var _a, _b, _c, _d;
2691
2797
  const res = await client.request(
2692
- transactionSchema.getTransaction(
2798
+ storeSchema.getStore(
2693
2799
  gqlQueryStringBuilder(
2694
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
2695
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
2800
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreResponse,
2801
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreResponseNestedFields
2696
2802
  )
2697
2803
  ),
2698
2804
  input,
2699
2805
  option
2700
2806
  );
2701
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
2807
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStore) != null ? _d : null;
2702
2808
  },
2703
- async getTransactions(input, fetchFields, option) {
2809
+ async getStores(input, fetchFields, option) {
2704
2810
  var _a, _b, _c, _d;
2705
2811
  const res = await client.request(
2706
- transactionSchema.getTransactions(
2812
+ storeSchema.getStores(
2707
2813
  gqlQueryStringBuilder(
2708
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
2709
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
2814
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoresResponse,
2815
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoresResponseNestedFields
2710
2816
  )
2711
2817
  ),
2712
2818
  input,
2713
2819
  option
2714
2820
  );
2715
- return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
2821
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStores) != null ? _d : null;
2716
2822
  }
2717
2823
  });
2718
2824
 
2719
- // src/services/subscription/schemas/paystack.schema.ts
2720
- var paystackSchema = {
2721
- paystackInitializeSubscription: (query) => `
2722
- mutation paystackInitializeSubscription($userId: String!, $planId: String!, $subscriptionFrequencyType: SubscriptionFrequencyTypeEnum!) {
2723
- paystackInitializeSubscription(userId: $userId, planId: $planId, subscriptionFrequencyType: $subscriptionFrequencyType) {
2825
+ // src/services/inventory/schema/store-category.schema.ts
2826
+ var storeCategorySchema = {
2827
+ createStoreCategory: (query) => `
2828
+ mutation createStoreCategory($storeCategory: StoreCategoryInput!) {
2829
+ createStoreCategory(storeCategory: $storeCategory) {
2724
2830
  ${query}
2725
2831
  }
2726
2832
  }
2727
2833
  `,
2728
- paystackInitializePayment: (query) => `
2729
- mutation paystackInitializePayment($userId: String!) {
2730
- paystackInitializePayment(userId: $userId) {
2834
+ updateStoreCategory: (query) => `
2835
+ mutation updateStoreCategory($storeCategoryId: String!, $storeCategory: StoreCategoryInput!) {
2836
+ updateStoreCategory(storeCategoryId: $storeCategoryId, storeCategory: $storeCategory) {
2837
+ ${query}
2838
+ }
2839
+ }
2840
+ `,
2841
+ removeStoreCategory: (query) => `
2842
+ mutation removeStoreCategory($storeCategoryId: String!) {
2843
+ removeStoreCategory(storeCategoryId: $storeCategoryId) {
2844
+ ${query}
2845
+ }
2846
+ }
2847
+ `,
2848
+ // get
2849
+ getStoreCategory: (query) => `
2850
+ query getStoreCategory($storeCategory: StoreCategoryInput!) {
2851
+ getStoreCategory(storeCategory: $storeCategory) {
2852
+ ${query}
2853
+ }
2854
+ }
2855
+ `,
2856
+ getStoreCategories: (query) => `
2857
+ query getStoreCategories($search: String, $storeCategory: StoreCategoryInput, $storeCategoryIds: [String], $limit: Int!, $skip: Int!) {
2858
+ getStoreCategories(search: $search, storeCategory: $storeCategory, storeCategoryIds: $storeCategoryIds, limit: $limit, skip: $skip) {
2731
2859
  ${query}
2732
2860
  }
2733
2861
  }
2734
2862
  `
2735
2863
  };
2736
2864
 
2737
- // src/services/subscription/types/paystack.ts
2738
- var paystackInitializePaymentResponse = [
2739
- "accessCode",
2740
- "authorizationUrl",
2741
- "reference"
2742
- ];
2743
- var paystackInitializeSubscriptionResponse = paystackInitializePaymentResponse;
2744
-
2745
- // src/services/subscription/paystack.service.ts
2746
- var createPaystackService = (client) => ({
2747
- async paystackInitializeSubscription(input, fetchFields, option) {
2748
- var _a, _b, _c;
2865
+ // src/services/inventory/store-category.service.ts
2866
+ var createStoreCategoryService = (client) => ({
2867
+ async getStoreCategories(input, fetchFields, option) {
2868
+ var _a, _b, _c, _d;
2749
2869
  const res = await client.request(
2750
- paystackSchema.paystackInitializeSubscription(
2870
+ storeCategorySchema.getStoreCategories(
2751
2871
  gqlQueryStringBuilder(
2752
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : paystackInitializeSubscriptionResponse
2872
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoriesResponseFields,
2873
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoriesResponseNestedFields
2753
2874
  )
2754
2875
  ),
2755
2876
  input,
2756
2877
  option
2757
2878
  );
2758
- return (_c = (_b = res.data) == null ? void 0 : _b.paystackInitializeSubscription) != null ? _c : null;
2879
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategories) != null ? _d : null;
2759
2880
  },
2760
- async paystackInitializePayment(input, fetchFields, option) {
2761
- var _a, _b;
2881
+ async getStoreCategory(input, fetchFields, option) {
2882
+ var _a, _b, _c, _d;
2762
2883
  const res = await client.request(
2763
- paystackSchema.paystackInitializePayment(
2884
+ storeCategorySchema.getStoreCategory(
2764
2885
  gqlQueryStringBuilder(
2765
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : paystackInitializePaymentResponse
2886
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryResponseFields,
2887
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryResponseNestedFields
2766
2888
  )
2767
2889
  ),
2768
2890
  input,
2769
2891
  option
2770
2892
  );
2771
- return (_b = res.data) == null ? void 0 : _b.paystackInitializePayment;
2772
- }
2773
- });
2774
-
2775
- // src/services/subscription/subscription.entity.ts
2776
- var subscriptionPlanFeatureBehaviourQuery = [
2777
- "id",
2778
- "createdAt",
2779
- "description",
2780
- "shortname",
2781
- "subscriptionPlanFeatureKey",
2782
- "title"
2783
- ];
2784
- var subscriptionQuery = [
2785
- "cancelAtPeriodEnd",
2786
- "canceledAt",
2787
- "createdAt",
2788
- "currency",
2789
- "currentPeriodEnd",
2790
- "currentPeriodStart",
2791
- "defaultPaymentMethodId",
2792
- "id",
2793
- "price",
2794
- "subscriptionPlanId",
2795
- "subscriptionStatus",
2796
- "trialEnd",
2797
- "updatedAt",
2798
- "userId",
2799
- "version"
2800
- ];
2801
- var subscriptionPlanFeatureQuery = [
2802
- "id",
2803
- "title",
2804
- "description",
2805
- "createdAt"
2806
- ];
2807
- var subscriptionPlanQuery = [
2808
- "id",
2809
- "code",
2810
- "title",
2811
- "description",
2812
- "currency",
2813
- "period",
2814
- "trialDays",
2815
- "subscriptionPlanStatus",
2816
- "createdAt",
2817
- "updatedAt",
2818
- "features",
2819
- "monthlyPlanPrice",
2820
- "annuallyPlanPrice"
2821
- ];
2822
-
2823
- // src/services/subscription/types/subscription-plan-feature.type.ts
2824
- var getSubscriptionPlanFeatureResponse = [
2825
- "subscriptionPlanFeature"
2826
- ];
2827
- var _getSubscriptionPlanFeatureResponseNestedFields = {};
2828
- var getSubscriptionPlanFeatureResponseNestedFields = {
2829
- ..._getSubscriptionPlanFeatureResponseNestedFields,
2830
- subscriptionPlanFeature: subscriptionPlanFeatureQuery
2831
- };
2832
- var getSubscriptionPlanFeaturesResponse = [
2833
- "subscriptionPlanFeatures",
2834
- "total"
2835
- ];
2836
- var getSubscriptionPlanFeaturesResponseNestedFields = {
2837
- ..._getSubscriptionPlanFeatureResponseNestedFields,
2838
- subscriptionPlanFeatures: subscriptionPlanFeatureQuery
2839
- };
2840
- var addSubscriptionPlanFeatureResponse = getSubscriptionPlanFeatureResponse;
2841
- var addSubscriptionPlanFeatureResponseNestedFields = getSubscriptionPlanFeatureResponseNestedFields;
2842
- var updateSubscriptionPlanFeatureResponse = getSubscriptionPlanFeatureResponse;
2843
- var updateSubscriptionPlanFeatureResponseNestedFields = getSubscriptionPlanFeatureResponseNestedFields;
2844
- var removeSubscriptionPlanFeatureResponse = [
2845
- "subscriptionPlanFeatureId"
2846
- ];
2847
-
2848
- // src/services/subscription/types/subscription-plan.type.ts
2849
- var getSubscriptionPlanResponse = [
2850
- "subscriptionPlan"
2851
- ];
2852
- var _getSubscriptionPlanResponseNestedFields = {
2853
- features: subscriptionPlanFeatureQuery
2854
- };
2855
- var getSubscriptionPlanResponseNestedFields = {
2856
- ..._getSubscriptionPlanResponseNestedFields,
2857
- subscriptionPlan: subscriptionPlanQuery
2858
- };
2859
- var getSubscriptionPlansResponse = [
2860
- "subscriptionPlans",
2861
- "total"
2862
- ];
2863
- var getSubscriptionPlansResponseNestedFields = {
2864
- ..._getSubscriptionPlanResponseNestedFields,
2865
- subscriptionPlans: subscriptionPlanQuery
2866
- };
2867
- var addSubscriptionPlanResponse = getSubscriptionPlanResponse;
2868
- var addSubscriptionPlanResponseNestedFields = getSubscriptionPlanResponseNestedFields;
2869
- var updateSubscriptionPlanResponse = getSubscriptionPlanResponse;
2870
- var updateSubscriptionPlanResponseNestedFields = getSubscriptionPlanResponseNestedFields;
2871
- var removeSubscriptionPlanResponse = [
2872
- "subscriptionPlanId"
2873
- ];
2874
-
2875
- // src/services/subscription/types/subscription.type.ts
2876
- var getSubscriptionResponse = [
2877
- "subscription"
2878
- ];
2879
- var _getSubscriptionResponseNestedFields = {};
2880
- var getSubscriptionResponseNestedFields = {
2881
- ..._getSubscriptionResponseNestedFields,
2882
- subscription: subscriptionQuery
2883
- };
2884
- var getSubscriptionsResponse = [
2885
- "subscriptions",
2886
- "total"
2887
- ];
2888
- var getSubscriptionsResponseNestedFields = {
2889
- ..._getSubscriptionResponseNestedFields,
2890
- subscriptions: subscriptionQuery
2891
- };
2892
- var addSubscriptionResponse = getSubscriptionResponse;
2893
- var addSubscriptionResponseNestedFields = getSubscriptionResponseNestedFields;
2894
- var updateSubscriptionResponse = getSubscriptionResponse;
2895
- var updateSubscriptionResponseNestedFields = getSubscriptionResponseNestedFields;
2896
- var removeSubscriptionResponse = [
2897
- "subscriptionId"
2898
- ];
2899
-
2900
- // src/services/subscription/types/subscription-plan-feature-behaviour.type.ts
2901
- var ENTITY4 = "subscriptionPlanFeatureBehaviour";
2902
- var subscriptionPlanFeatureBehaviourIntegration = createStandardEntityIntegration({
2903
- key: ENTITY4,
2904
- fields: subscriptionPlanFeatureBehaviourQuery
2905
- });
2906
- var subscriptionPlanFeatureBehaviourListIntegration = createListIntegration({
2907
- key: "subscriptionPlanFeatureBehaviours",
2908
- fields: subscriptionPlanFeatureBehaviourQuery
2893
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategory) != null ? _d : null;
2894
+ },
2895
+ async updateStoreCategory(input, fetchFields, option) {
2896
+ var _a, _b, _c, _d;
2897
+ const res = await client.request(
2898
+ storeCategorySchema.updateStoreCategory(
2899
+ gqlQueryStringBuilder(
2900
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreCategoryResponseFields,
2901
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreCategoryResponseNestedFields
2902
+ )
2903
+ ),
2904
+ input,
2905
+ option
2906
+ );
2907
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateStoreCategory) != null ? _d : null;
2908
+ },
2909
+ async createStoreCategory(input, fetchFields, option) {
2910
+ var _a, _b, _c, _d;
2911
+ const res = await client.request(
2912
+ storeCategorySchema.createStoreCategory(
2913
+ gqlQueryStringBuilder(
2914
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createStoreCategoryResponseFields,
2915
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : createStoreCategoryResponseNestedFields
2916
+ )
2917
+ ),
2918
+ input,
2919
+ option
2920
+ );
2921
+ return (_d = (_c = res.data) == null ? void 0 : _c.createStoreCategory) != null ? _d : null;
2922
+ },
2923
+ async removeStoreCategory(input, fetchFields, option) {
2924
+ var _a, _b, _c;
2925
+ const res = await client.request(
2926
+ storeCategorySchema.removeStoreCategory(
2927
+ gqlQueryStringBuilder(
2928
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreCategoryResponseFields
2929
+ )
2930
+ ),
2931
+ input,
2932
+ option
2933
+ );
2934
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeStoreCategory) != null ? _c : null;
2935
+ }
2909
2936
  });
2910
- var subscriptionPlanFeatureBehaviourDeleteIntegration = createDeleteIntegration(ENTITY4);
2911
2937
 
2912
- // src/services/subscription/schemas/subscription-plan-feature.schema.ts
2913
- var subscriptionPlanFeatureSchema = {
2914
- getSubscriptionPlanFeature: (query) => `
2915
- query getSubscriptionPlanFeature($subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
2916
- getSubscriptionPlanFeature(subscriptionPlanFeature: $subscriptionPlanFeature) {
2938
+ // src/services/inventory/schema/store-category-product.schema.ts
2939
+ var storeCategoryProductSchema = {
2940
+ createStoreCategoryProduct: (query) => `
2941
+ mutation createStoreCategoryProduct($storeCategoryProduct: StoreCategoryProductInput!) {
2942
+ createStoreCategoryProduct(storeCategoryProduct: $storeCategoryProduct) {
2917
2943
  ${query}
2918
2944
  }
2919
2945
  }
2920
2946
  `,
2921
- getSubscriptionPlanFeatures: (query) => `
2922
- query getSubscriptionPlanFeatures($search: String, $subscriptionPlanFeatureIds: [String], $subscriptionPlanFeature: SubscriptionPlanFeatureInput, $limit: Int!, $skip: Int!) {
2923
- getSubscriptionPlanFeatures(search: $search, subscriptionPlanFeatureIds: $subscriptionPlanFeatureIds, subscriptionPlanFeature: $subscriptionPlanFeature, limit: $limit, skip: $skip) {
2947
+ updateStoreCategoryProduct: (query) => `
2948
+ mutation updateStoreCategoryProduct($storeCategoryProductId: String!, $storeCategoryProduct: StoreCategoryProductInput!) {
2949
+ updateStoreCategoryProduct(storeCategoryProductId: $storeCategoryProductId, storeCategoryProduct: $storeCategoryProduct) {
2924
2950
  ${query}
2925
2951
  }
2926
2952
  }
2927
2953
  `,
2928
- addSubscriptionPlanFeature: (query) => `
2929
- mutation addSubscriptionPlanFeature($subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
2930
- addSubscriptionPlanFeature(subscriptionPlanFeature: $subscriptionPlanFeature) {
2954
+ removeStoreCategoryProduct: (query) => `
2955
+ mutation removeStoreCategoryProduct($storeCategoryProductId: String!) {
2956
+ removeStoreCategoryProduct(storeCategoryProductId: $storeCategoryProductId) {
2931
2957
  ${query}
2932
2958
  }
2933
2959
  }
2934
2960
  `,
2935
- updateSubscriptionPlanFeature: (query) => `
2936
- mutation updateSubscriptionPlanFeature($subscriptionPlanFeatureId: String!, $subscriptionPlanFeature: SubscriptionPlanFeatureInput!) {
2937
- updateSubscriptionPlanFeature(subscriptionPlanFeatureId: $subcriptionPlanFeatureId, subscriptionPlanFeature: $subscriptionPlanFeature) {
2961
+ // get
2962
+ getStoreCategoryProduct: (query) => `
2963
+ query getStoreCategoryProduct($storeCategoryProduct: StoreCategoryProductInput!) {
2964
+ getStoreCategoryProduct(storeCategoryProduct: $storeCategoryProduct) {
2938
2965
  ${query}
2939
2966
  }
2940
2967
  }
2941
2968
  `,
2942
- removeSubscriptionPlanFeature: (query) => `
2943
- mutation removeSubscriptionPlanFeature($subscriptionPlanFeatureId: String!) {
2944
- removeSubscriptionPlanFeature(subscriptionPlanFeatureId: $subcriptionPlanFeatureId) {
2969
+ getStoreCategoryProducts: (query) => `
2970
+ query getStoreCategoryProducts($search: String, $storeCategoryProduct: StoreCategoryProductInput, $storeCategoryProductIds: [String], $limit: Int!, $skip: Int!) {
2971
+ getStoreCategoryProducts(search: $search, storeCategoryProduct: $storeCategoryProduct, storeCategoryProductIds: $storeCategoryProductIds, limit: $limit, skip: $skip) {
2945
2972
  ${query}
2946
2973
  }
2947
2974
  }
2948
2975
  `
2949
2976
  };
2950
2977
 
2951
- // src/services/subscription/subscription-plan-feature.service.ts
2952
- var createSubscriptionPlanFeatureService = (client) => ({
2953
- async removeSubscriptionPlanFeature(input, fetchFields, option) {
2954
- var _a, _b, _c;
2978
+ // src/services/inventory/store-category-product.service.ts
2979
+ var createStoreCategoryProductService = (client) => ({
2980
+ async getStoreCategoryProducts(input, fetchFields, option) {
2981
+ var _a, _b, _c, _d;
2955
2982
  const res = await client.request(
2956
- subscriptionPlanFeatureSchema.removeSubscriptionPlanFeature(
2983
+ storeCategoryProductSchema.getStoreCategoryProducts(
2957
2984
  gqlQueryStringBuilder(
2958
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionPlanFeatureResponse
2985
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryProductsResponseFields,
2986
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryProductsResponseNestedFields
2959
2987
  )
2960
2988
  ),
2961
2989
  input,
2962
2990
  option
2963
2991
  );
2964
- return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscriptionPlanFeature) != null ? _c : null;
2992
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategoryProducts) != null ? _d : null;
2965
2993
  },
2966
- async updateSubscriptionPlanFeature(input, fetchFields, option) {
2994
+ async getStoreCategoryProduct(input, fetchFields, option) {
2967
2995
  var _a, _b, _c, _d;
2968
2996
  const res = await client.request(
2969
- subscriptionPlanFeatureSchema.updateSubscriptionPlanFeature(
2997
+ storeCategoryProductSchema.getStoreCategoryProduct(
2970
2998
  gqlQueryStringBuilder(
2971
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionPlanFeatureResponse,
2972
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionPlanFeatureResponseNestedFields
2999
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getStoreCategoryProductResponseFields,
3000
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getStoreCategoryProductResponseNestedFields
2973
3001
  )
2974
3002
  ),
2975
3003
  input,
2976
3004
  option
2977
3005
  );
2978
- return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscriptionPlanFeature) != null ? _d : null;
3006
+ return (_d = (_c = res.data) == null ? void 0 : _c.getStoreCategoryProduct) != null ? _d : null;
2979
3007
  },
2980
- async addSubscriptionPlanFeature(input, fetchFields, option) {
3008
+ async updateStoreCategoryProduct(input, fetchFields, option) {
2981
3009
  var _a, _b, _c, _d;
2982
3010
  const res = await client.request(
2983
- subscriptionPlanFeatureSchema.addSubscriptionPlanFeature(
3011
+ storeCategoryProductSchema.updateStoreCategoryProduct(
2984
3012
  gqlQueryStringBuilder(
2985
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionPlanFeatureResponse,
2986
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionPlanFeatureResponseNestedFields
3013
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateStoreCategoryProductResponseFields,
3014
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateStoreCategoryProductResponseNestedFields
2987
3015
  )
2988
3016
  ),
2989
3017
  input,
2990
3018
  option
2991
3019
  );
2992
- return (_d = (_c = res.data) == null ? void 0 : _c.addSubscriptionPlanFeature) != null ? _d : null;
3020
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateStoreCategoryProduct) != null ? _d : null;
2993
3021
  },
2994
- async getSubscriptionPlanFeature(input, fetchFields, option) {
3022
+ async createStoreCategoryProduct(input, fetchFields, option) {
2995
3023
  var _a, _b, _c, _d;
2996
3024
  const res = await client.request(
2997
- subscriptionPlanFeatureSchema.getSubscriptionPlanFeature(
3025
+ storeCategoryProductSchema.createStoreCategoryProduct(
2998
3026
  gqlQueryStringBuilder(
2999
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanFeatureResponse,
3000
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanFeatureResponseNestedFields
3027
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createStoreCategoryProductResponseFields,
3028
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : createStoreCategoryProductResponseNestedFields
3001
3029
  )
3002
3030
  ),
3003
3031
  input,
3004
3032
  option
3005
3033
  );
3006
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlanFeature) != null ? _d : null;
3034
+ return (_d = (_c = res.data) == null ? void 0 : _c.createStoreCategoryProduct) != null ? _d : null;
3007
3035
  },
3008
- async getSubscriptionPlanFeatures(input, fetchFields, option) {
3009
- var _a, _b, _c, _d;
3036
+ async removeStoreCategoryProduct(input, fetchFields, option) {
3037
+ var _a, _b, _c;
3010
3038
  const res = await client.request(
3011
- subscriptionPlanFeatureSchema.getSubscriptionPlanFeatures(
3039
+ storeCategoryProductSchema.removeStoreCategoryProduct(
3012
3040
  gqlQueryStringBuilder(
3013
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanFeaturesResponse,
3014
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanFeaturesResponseNestedFields
3041
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeStoreCategoryProductResponseFields
3015
3042
  )
3016
3043
  ),
3017
3044
  input,
3018
3045
  option
3019
3046
  );
3020
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlanFeatures) != null ? _d : null;
3047
+ return (_c = (_b = res.data) == null ? void 0 : _b.removeStoreCategoryProduct) != null ? _c : null;
3021
3048
  }
3022
3049
  });
3023
3050
 
3024
- // src/services/subscription/schemas/subscription-plan.schema.ts
3025
- var subscriptionPlanSchema = {
3026
- getSubscriptionPlan: (query) => `
3027
- query getSubscriptionPlan($subscriptionPlan: SubscriptionPlanInput!) {
3028
- getSubscriptionPlan(subscriptionPlan: $subscriptionPlan) {
3029
- ${query}
3030
- }
3031
- }
3032
- `,
3033
- getSubscriptionPlans: (query) => `
3034
- query getSubscriptionPlans($search: String, $subscriptionPlanIds: [String], $subscriptionPlan: SubscriptionPlanInput, $limit: Int!, $skip: Int!) {
3035
- getSubscriptionPlans(search: $search, subscriptionPlanIds: $subscriptionPlanIds, subscriptionPlan: $subscriptionPlan, limit: $limit, skip: $skip) {
3036
- ${query}
3037
- }
3038
- }
3039
- `,
3040
- addSubscriptionPlan: (query) => `
3041
- mutation addSubscriptionPlan($subscriptionPlan: SubscriptionPlanInput!) {
3042
- addSubscriptionPlan(subscriptionPlan: $subscriptionPlan) {
3043
- ${query}
3044
- }
3045
- }
3046
- `,
3047
- updateSubscriptionPlan: (query) => `
3048
- mutation updateSubscriptionPlan($subscriptionPlanId: String!, $subscriptionPlan: SubscriptionPlanInput!) {
3049
- updateSubscriptionPlan(subscriptionPlanId: $subscriptionPlanId, subscriptionPlan: $subscriptionPlan) {
3051
+ // src/services/sales/schemas/order.schema.ts
3052
+ var orderSchema = {
3053
+ getOrder: (query) => `
3054
+ query getOrder($order: OrderInput) {
3055
+ getOrder(order: $order){
3050
3056
  ${query}
3051
3057
  }
3052
3058
  }
3053
3059
  `,
3054
- removeSubscriptionPlan: (query) => `
3055
- mutation removeSubscriptionPlan($subscriptionPlanId: String!) {
3056
- removeSubscriptionPlan(subscriptionPlanId: $subscriptionPlanId) {
3060
+ getOrders: (query) => `
3061
+ query getOrders($orderIds: [String], $order: OrderInput, $limit: Int, $skip: Int){
3062
+ getOrders(orderIds: $orderIds, order: $order, limit: $limit, skip: $skip){
3057
3063
  ${query}
3058
3064
  }
3059
3065
  }
3060
3066
  `
3061
3067
  };
3062
3068
 
3063
- // src/services/subscription/subscription-plan.service.ts
3064
- var createSubscriptionPlanService = (client) => ({
3065
- async removeSubscriptionPlan(input, fetchFields, option) {
3066
- var _a, _b, _c;
3067
- const res = await client.request(
3068
- subscriptionPlanSchema.removeSubscriptionPlan(
3069
- gqlQueryStringBuilder(
3070
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionPlanResponse
3071
- )
3072
- ),
3073
- input,
3074
- option
3075
- );
3076
- return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscriptionPlan) != null ? _c : null;
3077
- },
3078
- async updateSubscriptionPlan(input, fetchFields, option) {
3069
+ // src/services/sales/sale.entity.ts
3070
+ var transactionQuery = [
3071
+ "_id",
3072
+ "amountPaid",
3073
+ "amountTotal",
3074
+ "createdAt",
3075
+ "from",
3076
+ "fromWallet",
3077
+ "isCredit",
3078
+ "paymentDate",
3079
+ "paymentType",
3080
+ "platform",
3081
+ "saleIds",
3082
+ "saleStatus",
3083
+ "sales",
3084
+ "storeId",
3085
+ "to",
3086
+ "toWallet",
3087
+ "txStatus"
3088
+ ];
3089
+ var orderQuery = [
3090
+ "_id",
3091
+ "createdAt",
3092
+ "orderStatus",
3093
+ "transactionId",
3094
+ "userId"
3095
+ ];
3096
+ var saleQuery = [
3097
+ "_id",
3098
+ "amountTotal",
3099
+ "createdAt",
3100
+ "packageId",
3101
+ "productId",
3102
+ "quantity",
3103
+ "storeId"
3104
+ ];
3105
+
3106
+ // src/services/sales/types/order.type.ts
3107
+ var getOrderResponse = ["order"];
3108
+ var getOrderResponseNestedFields = {
3109
+ order: orderQuery
3110
+ };
3111
+ var getOrdersResponse = ["orders"];
3112
+ var getOrdersResponseNestedFields = {
3113
+ orders: orderQuery
3114
+ };
3115
+
3116
+ // src/services/sales/order.service.ts
3117
+ var createOrderService = (client) => ({
3118
+ async getOrder(input, fetchFields, option) {
3079
3119
  var _a, _b, _c, _d;
3080
3120
  const res = await client.request(
3081
- subscriptionPlanSchema.updateSubscriptionPlan(
3121
+ orderSchema.getOrder(
3082
3122
  gqlQueryStringBuilder(
3083
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionPlanResponse,
3084
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionPlanResponseNestedFields
3123
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getOrderResponse,
3124
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getOrderResponseNestedFields
3085
3125
  )
3086
3126
  ),
3087
3127
  input,
3088
3128
  option
3089
3129
  );
3090
- return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscriptionPlan) != null ? _d : null;
3130
+ return (_d = (_c = res.data) == null ? void 0 : _c.getOrder) != null ? _d : null;
3091
3131
  },
3092
- async addSubscriptionPlan(input, fetchFields, option) {
3132
+ async getOrders(input, fetchFields, option) {
3093
3133
  var _a, _b, _c, _d;
3094
3134
  const res = await client.request(
3095
- subscriptionPlanSchema.addSubscriptionPlan(
3135
+ orderSchema.getOrders(
3096
3136
  gqlQueryStringBuilder(
3097
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionPlanResponse,
3098
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionPlanResponseNestedFields
3137
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getOrdersResponse,
3138
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getOrdersResponseNestedFields
3099
3139
  )
3100
3140
  ),
3101
3141
  input,
3102
3142
  option
3103
3143
  );
3104
- return (_d = (_c = res.data) == null ? void 0 : _c.addSubscriptionPlan) != null ? _d : null;
3105
- },
3106
- async getSubscriptionPlan(input, fetchFields, option) {
3144
+ return (_d = (_c = res.data) == null ? void 0 : _c.getOrders) != null ? _d : null;
3145
+ }
3146
+ });
3147
+
3148
+ // src/services/sales/schemas/sale.schema.ts
3149
+ var saleSchema = {
3150
+ getSales: (query) => `
3151
+ query getSales($saleIds: [String], $saleFilter: SaleFilterInput, $ShouldGetFromAllStores: Boolean, $dateFilter: DateFilterInput, $limit: Int, $skip: Int) {
3152
+ getSales(saleIds: $saleIds, saleFilter: $saleFilter, ShouldGetFromAllStores: $ShouldGetFromAllStores, dateFilter: $dateFilter, limit: $limit, skip: $skip) {
3153
+ ${query}
3154
+ }
3155
+ }
3156
+ `,
3157
+ updateSale: (query) => `
3158
+ mutation updateSale($saleId: String!, $sale: SaleInput!) {
3159
+ updateSale(saleId: $saleId, sale: $sale) {
3160
+ ${query}
3161
+ }
3162
+ }
3163
+ `
3164
+ };
3165
+
3166
+ // src/services/sales/types/sale.type.ts
3167
+ var getSaleResponse = ["sale"];
3168
+ var _getSaleResponseNestedFields = {
3169
+ ..._getProductResponseNestedFields
3170
+ };
3171
+ var getSaleResponseNestedFields = {
3172
+ sale: saleQuery,
3173
+ ..._getSaleResponseNestedFields
3174
+ };
3175
+ var getSalesResponse = [
3176
+ "sales",
3177
+ "uniqueProducts"
3178
+ ];
3179
+ var getSalesResponseNestedFields = {
3180
+ sales: saleQuery,
3181
+ uniqueProducts: productQuery,
3182
+ ..._getSaleResponseNestedFields
3183
+ };
3184
+ var UpdateSaleResponse = ["sale"];
3185
+ var updateSaleResponseNestedFields = getSaleResponseNestedFields;
3186
+
3187
+ // src/services/sales/sale.service.ts
3188
+ var createSaleService = (client) => ({
3189
+ async updateSale(input, fetchFields, option) {
3107
3190
  var _a, _b, _c, _d;
3108
3191
  const res = await client.request(
3109
- subscriptionPlanSchema.getSubscriptionPlan(
3192
+ saleSchema.updateSale(
3110
3193
  gqlQueryStringBuilder(
3111
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlanResponse,
3112
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlanResponseNestedFields
3194
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : UpdateSaleResponse,
3195
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSaleResponseNestedFields
3113
3196
  )
3114
3197
  ),
3115
3198
  input,
3116
3199
  option
3117
3200
  );
3118
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlan) != null ? _d : null;
3201
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateSale) != null ? _d : null;
3119
3202
  },
3120
- async getSubscriptionPlans(input, fetchFields, option) {
3203
+ async getSales(input, fetchFields, option) {
3121
3204
  var _a, _b, _c, _d;
3122
3205
  const res = await client.request(
3123
- subscriptionPlanSchema.getSubscriptionPlans(
3206
+ saleSchema.getSales(
3124
3207
  gqlQueryStringBuilder(
3125
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionPlansResponse,
3126
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionPlansResponseNestedFields
3208
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSalesResponse,
3209
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSalesResponseNestedFields
3127
3210
  )
3128
3211
  ),
3129
3212
  input,
3130
3213
  option
3131
3214
  );
3132
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptionPlans) != null ? _d : null;
3215
+ return (_d = (_c = res.data) == null ? void 0 : _c.getSales) != null ? _d : null;
3133
3216
  }
3134
3217
  });
3135
3218
 
3136
- // src/services/subscription/schemas/subscription.schema.ts
3137
- var subscriptionSchema = {
3138
- getSubscription: (query) => `
3139
- query getSubscription($subscription: SubscriptionInput!) {
3140
- getSubscription(subscription: $subscription) {
3141
- ${query}
3142
- }
3143
- }
3144
- `,
3145
- getSubscriptions: (query) => `
3146
- query getSubscriptions($search: String, $subscriptionIds: [String], $subscription: SubscriptionInput, $limit: Int!, $skip: Int!) {
3147
- getSubscriptions(search: $search, subscriptionIds: $subscriptionIds, subscription: $subscription, limit: $limit, skip: $skip) {
3219
+ // src/services/sales/schemas/transaction.schema.ts
3220
+ var transactionSchema = {
3221
+ getTransaction: (query) => `
3222
+ query getTransaction($transaction: TransactionInput!){
3223
+ getTransaction(transaction: $transaction){
3148
3224
  ${query}
3149
3225
  }
3150
3226
  }
3151
3227
  `,
3152
- addSubscription: (query) => `
3153
- mutation addSubscription($subscription: SubscriptionInput!) {
3154
- addSubscription(subscription: $subscription) {
3228
+ getTransactions: (query) => `
3229
+ query getTransactions($dateFilter: DateFilterInput, $transactionIds: [String], $transaction: TransactionInput, $limit: Int, $skip: Int, $shouldGetFromAllStores: Boolean){
3230
+ getTransactions(dateFilter: $dateFilter, transactionIds: $transactionIds, transaction: $transaction, limit: $limit, skip: $skip, shouldGetFromAllStores: $shouldGetFromAllStores){
3155
3231
  ${query}
3156
3232
  }
3157
3233
  }
3158
3234
  `,
3159
- updateSubscription: (query) => `
3160
- mutation updateSubscription($subscriptionId: String!, $subscription: SubscriptionInput!) {
3161
- updateSubscription(subscriptionId: $subcriptionId, subscription: $subscription) {
3235
+ addTransaction: (query) => `
3236
+ mutation addTransaction($transaction: TransactionInput!){
3237
+ addTransaction(transaction: $transaction){
3162
3238
  ${query}
3163
3239
  }
3164
3240
  }
3165
3241
  `,
3166
- removeSubscription: (query) => `
3167
- mutation removeSubscription($subscriptionId: String!) {
3168
- removeSubscription(subscriptionId: $subcriptionId) {
3242
+ updateTransaction: (query) => `
3243
+ mutation updateTransaction($transactionId: String!, $transaction: TransactionInput!){
3244
+ updateTransaction(transactionId: $transactionId, transaction: $transaction){
3169
3245
  ${query}
3170
3246
  }
3171
3247
  }
3172
3248
  `
3173
3249
  };
3174
3250
 
3175
- // src/services/subscription/subscription.service.ts
3176
- var createSubscriptionService = (client) => ({
3177
- async removeSubscription(input, fetchFields, option) {
3178
- var _a, _b, _c;
3179
- const res = await client.request(
3180
- subscriptionSchema.removeSubscription(
3181
- gqlQueryStringBuilder(
3182
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : removeSubscriptionResponse
3183
- )
3184
- ),
3185
- input,
3186
- option
3187
- );
3188
- return (_c = (_b = res.data) == null ? void 0 : _b.removeSubscription) != null ? _c : null;
3189
- },
3190
- async updateSubscription(input, fetchFields, option) {
3251
+ // src/services/sales/types/transaction.type.ts
3252
+ var getTransactionResponse = [
3253
+ "transaction"
3254
+ ];
3255
+ var _getTransactionResponseNestedFields = {
3256
+ sales: saleQuery
3257
+ };
3258
+ var getTransactionResponseNestedFields = {
3259
+ transaction: transactionQuery,
3260
+ ..._getTransactionResponseNestedFields
3261
+ };
3262
+ var getTransactionsResponse = [
3263
+ "transactions",
3264
+ "uniqueProducts"
3265
+ ];
3266
+ var _getTransactionsResponseNestedFields = {
3267
+ sales: saleQuery,
3268
+ uniqueProducts: productNameQuery,
3269
+ ..._getProductResponseNestedFields
3270
+ };
3271
+ var getTransactionsResponseNestedFields = {
3272
+ transactions: transactionQuery,
3273
+ ..._getTransactionsResponseNestedFields
3274
+ };
3275
+ var addTransactionResponse = getTransactionResponse;
3276
+ var addTransactionResponseNestedFields = getTransactionResponseNestedFields;
3277
+ var updateTransactionResponse = getTransactionResponse;
3278
+ var updateTransactionResponseNestedFields = getTransactionResponseNestedFields;
3279
+
3280
+ // src/services/sales/transaction.service.ts
3281
+ var createTransactionService = (client) => ({
3282
+ async updateTransaction(input, fetchFields, option) {
3191
3283
  var _a, _b, _c, _d;
3192
3284
  const res = await client.request(
3193
- subscriptionSchema.updateSubscription(
3285
+ transactionSchema.updateTransaction(
3194
3286
  gqlQueryStringBuilder(
3195
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateSubscriptionResponse,
3196
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateSubscriptionResponseNestedFields
3287
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : updateTransactionResponse,
3288
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : updateTransactionResponseNestedFields
3197
3289
  )
3198
3290
  ),
3199
3291
  input,
3200
3292
  option
3201
3293
  );
3202
- return (_d = (_c = res.data) == null ? void 0 : _c.updateSubscription) != null ? _d : null;
3294
+ return (_d = (_c = res.data) == null ? void 0 : _c.updateTransaction) != null ? _d : null;
3203
3295
  },
3204
- async addSubscription(input, fetchFields, option) {
3296
+ async addTransaction(input, fetchFields, option) {
3205
3297
  var _a, _b, _c, _d;
3206
3298
  const res = await client.request(
3207
- subscriptionSchema.addSubscription(
3299
+ transactionSchema.addTransaction(
3208
3300
  gqlQueryStringBuilder(
3209
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addSubscriptionResponse,
3210
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addSubscriptionResponseNestedFields
3301
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : addTransactionResponse,
3302
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : addTransactionResponseNestedFields
3211
3303
  )
3212
3304
  ),
3213
3305
  input,
3214
3306
  option
3215
3307
  );
3216
- return (_d = (_c = res.data) == null ? void 0 : _c.addSubscription) != null ? _d : null;
3308
+ return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3217
3309
  },
3218
- async getSubscription(input, fetchFields, option) {
3310
+ async getTransaction(input, fetchFields, option) {
3219
3311
  var _a, _b, _c, _d;
3220
3312
  const res = await client.request(
3221
- subscriptionSchema.getSubscription(
3313
+ transactionSchema.getTransaction(
3222
3314
  gqlQueryStringBuilder(
3223
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionResponse,
3224
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionResponseNestedFields
3315
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionResponse,
3316
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionResponseNestedFields
3225
3317
  )
3226
3318
  ),
3227
3319
  input,
3228
3320
  option
3229
3321
  );
3230
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscription) != null ? _d : null;
3322
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransaction) != null ? _d : null;
3231
3323
  },
3232
- async getSubscriptions(input, fetchFields, option) {
3324
+ async getTransactions(input, fetchFields, option) {
3233
3325
  var _a, _b, _c, _d;
3234
3326
  const res = await client.request(
3235
- subscriptionSchema.getSubscriptions(
3327
+ transactionSchema.getTransactions(
3236
3328
  gqlQueryStringBuilder(
3237
- (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getSubscriptionsResponse,
3238
- (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getSubscriptionsResponseNestedFields
3329
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getTransactionsResponse,
3330
+ (_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : getTransactionsResponseNestedFields
3239
3331
  )
3240
3332
  ),
3241
3333
  input,
3242
3334
  option
3243
3335
  );
3244
- return (_d = (_c = res.data) == null ? void 0 : _c.getSubscriptions) != null ? _d : null;
3245
- }
3246
- });
3247
-
3248
- // src/services/subscription/schemas/subscription-plan-feature-behaviour.ts
3249
- var subscriptionPlanFeatureBehaviourSchema = {
3250
- get: {
3251
- operation: "query",
3252
- name: "getSubscriptionPlanFeatureBehaviour",
3253
- variables: "($subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
3254
- field: "(subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
3255
- },
3256
- list: {
3257
- operation: "query",
3258
- name: "getSubscriptionPlanFeatureBehaviours",
3259
- variables: "($limit: Int!, $skip: Int!, $search: String, $subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput, $subscriptionPlanFeatureBehaviourIds: [String])",
3260
- field: "(limit: $limit, skip: $skip, search: $search, subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour, subscriptionPlanFeatureBehaviourIds: $subscriptionPlanFeatureBehaviourIds)"
3261
- },
3262
- create: {
3263
- operation: "mutation",
3264
- name: "createSubscriptionPlanFeatureBehaviour",
3265
- variables: "($subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
3266
- field: "(subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
3267
- },
3268
- update: {
3269
- operation: "mutation",
3270
- name: "updateSubscriptionPlanFeatureBehaviour",
3271
- variables: "($subscriptionPlanFeatureBehaviourId: String!, $subscriptionPlanFeatureBehaviour: SubscriptionPlanFeatureBehaviourInput!)",
3272
- field: "(subscriptionPlanFeatureBehaviourId: $subscriptionPlanFeatureBehaviourId, subscriptionPlanFeatureBehaviour: $subscriptionPlanFeatureBehaviour)"
3273
- },
3274
- delete: {
3275
- operation: "mutation",
3276
- name: "removeSubscriptionPlanFeatureBehaviour",
3277
- variables: "($subscriptionPlanFeatureBehaviourId: String!)",
3278
- field: "(subscriptionPlanFeatureBehaviourId: $subscriptionPlanFeatureBehaviourId)"
3336
+ return (_d = (_c = res.data) == null ? void 0 : _c.getTransactions) != null ? _d : null;
3279
3337
  }
3280
- };
3281
-
3282
- // src/services/subscription/subscription-plan-feature-behaviour.service.ts
3283
- var createSubscriptionPlanFeatureBehaviourService = (client) => ({
3284
- createSubscriptionPlanFeatureBehaviour: createOperationExecutor(
3285
- client,
3286
- "createSubscriptionPlanFeatureBehaviour",
3287
- {
3288
- schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.create),
3289
- defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.create.responseFields,
3290
- defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.create.nestedFields
3291
- }
3292
- ),
3293
- updateSubscriptionPlanFeatureBehaviour: createOperationExecutor(
3294
- client,
3295
- "updateSubscriptionPlanFeatureBehaviour",
3296
- {
3297
- schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.update),
3298
- defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.update.responseFields,
3299
- defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.update.nestedFields
3300
- }
3301
- ),
3302
- getSubscriptionPlanFeatureBehaviour: createOperationExecutor(
3303
- client,
3304
- "getSubscriptionPlanFeatureBehaviour",
3305
- {
3306
- schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.get),
3307
- defaultRootFields: subscriptionPlanFeatureBehaviourIntegration.get.responseFields,
3308
- defaultNestedFields: subscriptionPlanFeatureBehaviourIntegration.get.nestedFields
3309
- }
3310
- ),
3311
- removeSubscriptionPlanFeatureBehaviour: createOperationExecutor(
3312
- client,
3313
- "removeSubscriptionPlanFeatureBehaviour",
3314
- {
3315
- schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.delete),
3316
- defaultRootFields: subscriptionPlanFeatureBehaviourDeleteIntegration.responseFields,
3317
- defaultNestedFields: {}
3318
- }
3319
- ),
3320
- getSubscriptionPlanFeatureBehaviours: createOperationExecutor(
3321
- client,
3322
- "getSubscriptionPlanFeatureBehaviours",
3323
- {
3324
- schema: buildSchema(subscriptionPlanFeatureBehaviourSchema.list),
3325
- defaultRootFields: [...subscriptionPlanFeatureBehaviourListIntegration.responseFields],
3326
- defaultNestedFields: subscriptionPlanFeatureBehaviourListIntegration.nestedFields
3327
- }
3328
- )
3329
3338
  });
3330
3339
 
3331
3340
  export { AuthenticationError, GraphQLClient, NetworkError, SdkError, SubscriptionPlanFeatureKeyLabels, UpdateSaleResponse, _getPackageResponseNestedFields, _getProductResponseNestedFields, _getSaleResponseNestedFields, _getStoreResponseNestedFields, _getSubscriptionPlanFeatureResponseNestedFields, _getSubscriptionPlanResponseNestedFields, _getSubscriptionResponseNestedFields, _getTransactionResponseNestedFields, _getTransactionsResponseNestedFields, addPackageResponseFields, addPackageResponseNestedFields, addPackagesResponseFields, addPackagesResponseNestedFields, addPriceResponseFields, addPriceResponseNestedFields, addProductResponseFields, addProductResponseNestedFields, addStockResponse, addStockResponseNestedFields, addStoreResponse, addStoreResponseNestedFields, addSubscriptionPlanFeatureResponse, addSubscriptionPlanFeatureResponseNestedFields, addSubscriptionPlanResponse, addSubscriptionPlanResponseNestedFields, addSubscriptionResponse, addSubscriptionResponseNestedFields, addTransactionResponse, addTransactionResponseNestedFields, compose, createApplicationFeatureService, createAuthService, createOrderService, createPackageService, createPaystackService, createPriceService, createProductService, createSaleService, createStockService, createStoreCategoryProductResponseFields, createStoreCategoryProductResponseNestedFields, createStoreCategoryProductService, createStoreCategoryResponseFields, createStoreCategoryResponseNestedFields, createStoreCategoryService, createStoreService, createSubscriptionPlanFeatureBehaviourService, createSubscriptionPlanFeatureService, createSubscriptionPlanService, createSubscriptionService, createTransactionService, createTransport, createUserAccountService, createUserNotificationService, createUserRoleService, createUserService, getCustomerProductCountsByIdsResponse, getCustomerProductCountsByIdsResponseNestedFields, getOrderResponse, getOrderResponseNestedFields, getOrdersResponse, getOrdersResponseNestedFields, getPackageResponseFields, getPackageResponseNestedFields, getPackagesResponseFields, getPackagesResponseNestedFields, getPriceResponseFields, getPriceResponseNestedFields, getPricesResponseFields, getPricesResponseNestedFields, getProductByBarcodeResponse, getProductByBarcodeResponseNestedFields, getProductResponseFields, getProductResponseNestedFields, getProductsResponseFields, getProductsResponseNestedFields, getSaleResponse, getSaleResponseNestedFields, getSalesResponse, getSalesResponseNestedFields, getStockResponse, getStockResponseNestedFields, getStocksResponse, getStocksResponseNestedFields, getStoreCategoriesResponseFields, getStoreCategoriesResponseNestedFields, getStoreCategoryProductResponseFields, getStoreCategoryProductResponseNestedFields, getStoreCategoryProductsResponseFields, getStoreCategoryProductsResponseNestedFields, getStoreCategoryResponseFields, getStoreCategoryResponseNestedFields, getStoreCountResponse, getStoreResponse, getStoreResponseNestedFields, getStoresResponse, getStoresResponseNestedFields, getSubscriptionPlanFeatureResponse, getSubscriptionPlanFeatureResponseNestedFields, getSubscriptionPlanFeaturesResponse, getSubscriptionPlanFeaturesResponseNestedFields, getSubscriptionPlanResponse, getSubscriptionPlanResponseNestedFields, getSubscriptionPlansResponse, getSubscriptionPlansResponseNestedFields, getSubscriptionResponse, getSubscriptionResponseNestedFields, getSubscriptionsResponse, getSubscriptionsResponseNestedFields, getTransactionResponse, getTransactionResponseNestedFields, getTransactionsResponse, getTransactionsResponseNestedFields, orderQuery, paystackInitializePaymentResponse, paystackInitializeSubscriptionResponse, removePackageResponseFields, removePriceResponseFields, removeProductResponseFields, removeStockResponse, removeStoreCategoryProductResponseFields, removeStoreCategoryResponseFields, removeStoreResponse, removeSubscriptionPlanFeatureResponse, removeSubscriptionPlanResponse, removeSubscriptionResponse, saleQuery, searchCategoriesAndTemplateResponse, searchCategoriesAndTemplateResponseNestedFields, searchProductNamesResponse, searchProductNamesResponseNestedFields, subscriptionPlanFeatureBehaviourDeleteIntegration, subscriptionPlanFeatureBehaviourIntegration, subscriptionPlanFeatureBehaviourListIntegration, toAsyncHeadersFactory, toAsyncTokenProvider, transactionQuery, updatePackageResponseFields, updatePackageResponseNestedFields, updatePriceResponseFields, updatePriceResponseNestedFields, updateProductResponseFields, updateProductResponseNestedFields, updateSaleResponseNestedFields, updateStockResponse, updateStockResponseNestedFields, updateStoreCategoryProductResponseFields, updateStoreCategoryProductResponseNestedFields, updateStoreCategoryResponseFields, updateStoreCategoryResponseNestedFields, updateStoreResponse, updateStoreResponseNestedFields, updateSubscriptionPlanFeatureResponse, updateSubscriptionPlanFeatureResponseNestedFields, updateSubscriptionPlanResponse, updateSubscriptionPlanResponseNestedFields, updateSubscriptionResponse, updateSubscriptionResponseNestedFields, updateTransactionResponse, updateTransactionResponseNestedFields };