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