@connect-plus-online/ogabai-integrations 0.0.54 → 0.0.56
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 +305 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +139 -1
- package/dist/index.d.ts +139 -1
- package/dist/index.esm.js +304 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -230,6 +230,30 @@ var userSchema = {
|
|
|
230
230
|
var user_schema_default = userSchema;
|
|
231
231
|
|
|
232
232
|
// src/services/user/user.entity.ts
|
|
233
|
+
var privilegeQuery = [
|
|
234
|
+
"actions",
|
|
235
|
+
"feature"
|
|
236
|
+
];
|
|
237
|
+
var userAccountQuery = [
|
|
238
|
+
"createdAt",
|
|
239
|
+
"id",
|
|
240
|
+
"storeId",
|
|
241
|
+
"userId",
|
|
242
|
+
"userRoleId",
|
|
243
|
+
"store",
|
|
244
|
+
"userRole"
|
|
245
|
+
];
|
|
246
|
+
var userRoleQuery = [
|
|
247
|
+
"createdAt",
|
|
248
|
+
"description",
|
|
249
|
+
"id",
|
|
250
|
+
"isRootAdmin",
|
|
251
|
+
"name",
|
|
252
|
+
"privileges",
|
|
253
|
+
"shortname",
|
|
254
|
+
"storeId",
|
|
255
|
+
"userRoleStatus"
|
|
256
|
+
];
|
|
233
257
|
var userTypeCountsQuery = [
|
|
234
258
|
"customers",
|
|
235
259
|
"distributors",
|
|
@@ -832,6 +856,283 @@ var createUserNotificationService = (client) => ({
|
|
|
832
856
|
}
|
|
833
857
|
});
|
|
834
858
|
|
|
859
|
+
// src/helpers/entity.factory.ts
|
|
860
|
+
function createEntityIntegration(config) {
|
|
861
|
+
var _a;
|
|
862
|
+
return {
|
|
863
|
+
responseFields: [config.key],
|
|
864
|
+
nestedFields: {
|
|
865
|
+
...(_a = config.nested) != null ? _a : {},
|
|
866
|
+
[config.key]: config.fields
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
function createListIntegration(config) {
|
|
871
|
+
var _a;
|
|
872
|
+
return {
|
|
873
|
+
responseFields: [config.key, "total"],
|
|
874
|
+
nestedFields: {
|
|
875
|
+
...(_a = config.nested) != null ? _a : {},
|
|
876
|
+
[config.key]: config.fields
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
function createDeleteIntegration(key) {
|
|
881
|
+
const idKey = `${key}Id`;
|
|
882
|
+
return {
|
|
883
|
+
responseFields: [idKey]
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
function createStandardEntityIntegration(config) {
|
|
887
|
+
const base = createEntityIntegration(config);
|
|
888
|
+
return {
|
|
889
|
+
get: base,
|
|
890
|
+
create: base,
|
|
891
|
+
update: base
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// src/services/user/types/user-account.type.ts
|
|
896
|
+
var ENTITY = "userAccount";
|
|
897
|
+
var userAccountIntegration = createStandardEntityIntegration({
|
|
898
|
+
key: ENTITY,
|
|
899
|
+
fields: userAccountQuery,
|
|
900
|
+
nested: {
|
|
901
|
+
userAccount: userAccountQuery,
|
|
902
|
+
store: storeQuery,
|
|
903
|
+
privileges: privilegeQuery
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
var userAccountListIntegration = createListIntegration({
|
|
907
|
+
key: "userAccounts",
|
|
908
|
+
fields: userAccountQuery,
|
|
909
|
+
nested: {
|
|
910
|
+
privileges: privilegeQuery,
|
|
911
|
+
userAccount: userAccountQuery,
|
|
912
|
+
store: storeQuery
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
var userAccountDeleteIntegration = createDeleteIntegration(ENTITY);
|
|
916
|
+
|
|
917
|
+
// src/services/user/schemas/user-account.schema.ts
|
|
918
|
+
var userAccountSchema = {
|
|
919
|
+
get: {
|
|
920
|
+
operation: "query",
|
|
921
|
+
name: "getUserAccount",
|
|
922
|
+
variables: "($userAccount: UserAccountInput!)",
|
|
923
|
+
field: "(userAccount: $userAccount)"
|
|
924
|
+
},
|
|
925
|
+
list: {
|
|
926
|
+
operation: "query",
|
|
927
|
+
name: "getUserAccounts",
|
|
928
|
+
variables: "($limit: Int!, $skip: Int!, $search: String, $userAccount: UserAccountInput, $userAccountIds: [String])",
|
|
929
|
+
field: "(limit: $limit, skip: $skip, search: $search, userAccount: $userAccount, userAccountIds: $userAccountIds)"
|
|
930
|
+
},
|
|
931
|
+
create: {
|
|
932
|
+
operation: "mutation",
|
|
933
|
+
name: "createUserAccount",
|
|
934
|
+
variables: "($userAccount: UserAccountInput!)",
|
|
935
|
+
field: "(userAccount: $userAccount)"
|
|
936
|
+
},
|
|
937
|
+
update: {
|
|
938
|
+
operation: "mutation",
|
|
939
|
+
name: "updateUserAccount",
|
|
940
|
+
variables: "($userAccountId: String!, $userAccount: UserAccountInput!)",
|
|
941
|
+
field: "(userAccountId: $userAccountId, userAccount: $userAccount)"
|
|
942
|
+
},
|
|
943
|
+
delete: {
|
|
944
|
+
operation: "mutation",
|
|
945
|
+
name: "removeUserAccount",
|
|
946
|
+
variables: "($userAccountId: String!)",
|
|
947
|
+
field: "(userAccountId: $userAccountId)"
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
// src/helpers/service.factory.ts
|
|
952
|
+
function createOperationExecutor(client, key, config) {
|
|
953
|
+
return async (input, fetchFields, option) => {
|
|
954
|
+
var _a, _b, _c;
|
|
955
|
+
const query = config.schema(
|
|
956
|
+
gqlQueryStringBuilder(
|
|
957
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : config.defaultRootFields,
|
|
958
|
+
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : config.defaultNestedFields
|
|
959
|
+
)
|
|
960
|
+
);
|
|
961
|
+
const res = await client.request(
|
|
962
|
+
query,
|
|
963
|
+
input,
|
|
964
|
+
option
|
|
965
|
+
);
|
|
966
|
+
return (_c = res.data) == null ? void 0 : _c[key];
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// src/helpers/schema-builder.ts
|
|
971
|
+
function buildSchema({
|
|
972
|
+
operation,
|
|
973
|
+
name,
|
|
974
|
+
variables,
|
|
975
|
+
field
|
|
976
|
+
}) {
|
|
977
|
+
return (selection) => `
|
|
978
|
+
${operation} ${name}${variables} {
|
|
979
|
+
${name}${field} {
|
|
980
|
+
${selection}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
`.trim();
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// src/services/user/user-account.service.ts
|
|
987
|
+
var createUserAccountService = (client) => ({
|
|
988
|
+
createUserAccount: createOperationExecutor(
|
|
989
|
+
client,
|
|
990
|
+
"createUserAccount",
|
|
991
|
+
{
|
|
992
|
+
schema: buildSchema(userAccountSchema.create),
|
|
993
|
+
defaultRootFields: userAccountIntegration.create.responseFields,
|
|
994
|
+
defaultNestedFields: userAccountIntegration.create.nestedFields
|
|
995
|
+
}
|
|
996
|
+
),
|
|
997
|
+
updateUserAccount: createOperationExecutor(
|
|
998
|
+
client,
|
|
999
|
+
"updateUserAccount",
|
|
1000
|
+
{
|
|
1001
|
+
schema: buildSchema(userAccountSchema.update),
|
|
1002
|
+
defaultRootFields: userAccountIntegration.update.responseFields,
|
|
1003
|
+
defaultNestedFields: userAccountIntegration.update.nestedFields
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
getUserAccount: createOperationExecutor(
|
|
1007
|
+
client,
|
|
1008
|
+
"getUserAccount",
|
|
1009
|
+
{
|
|
1010
|
+
schema: buildSchema(userAccountSchema.get),
|
|
1011
|
+
defaultRootFields: userAccountIntegration.get.responseFields,
|
|
1012
|
+
defaultNestedFields: userAccountIntegration.get.nestedFields
|
|
1013
|
+
}
|
|
1014
|
+
),
|
|
1015
|
+
removeUserAccount: createOperationExecutor(
|
|
1016
|
+
client,
|
|
1017
|
+
"removeUserAccount",
|
|
1018
|
+
{
|
|
1019
|
+
schema: buildSchema(userAccountSchema.delete),
|
|
1020
|
+
defaultRootFields: userAccountDeleteIntegration.responseFields,
|
|
1021
|
+
defaultNestedFields: {}
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
getUserAccounts: createOperationExecutor(
|
|
1025
|
+
client,
|
|
1026
|
+
"getUserAccounts",
|
|
1027
|
+
{
|
|
1028
|
+
schema: buildSchema(userAccountSchema.list),
|
|
1029
|
+
defaultRootFields: [...userAccountListIntegration.responseFields],
|
|
1030
|
+
defaultNestedFields: userAccountListIntegration.nestedFields
|
|
1031
|
+
}
|
|
1032
|
+
)
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
// src/services/user/types/user-role.type.ts
|
|
1036
|
+
var ENTITY2 = "userRole";
|
|
1037
|
+
var userRoleIntegration = createStandardEntityIntegration({
|
|
1038
|
+
key: ENTITY2,
|
|
1039
|
+
fields: userRoleQuery,
|
|
1040
|
+
nested: {
|
|
1041
|
+
privileges: privilegeQuery
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
var userRoleListIntegration = createListIntegration({
|
|
1045
|
+
key: "userRoles",
|
|
1046
|
+
fields: userRoleQuery,
|
|
1047
|
+
nested: {
|
|
1048
|
+
privileges: privilegeQuery
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
var userRoleDeleteIntegration = createDeleteIntegration(ENTITY2);
|
|
1052
|
+
|
|
1053
|
+
// src/services/user/schemas/user-role.schema.ts
|
|
1054
|
+
var userRoleSchema = {
|
|
1055
|
+
get: {
|
|
1056
|
+
operation: "query",
|
|
1057
|
+
name: "getUserRole",
|
|
1058
|
+
variables: "($userRole: UserRoleInput!)",
|
|
1059
|
+
field: "(userRole: $userRole)"
|
|
1060
|
+
},
|
|
1061
|
+
list: {
|
|
1062
|
+
operation: "query",
|
|
1063
|
+
name: "getUserRoles",
|
|
1064
|
+
variables: "($limit: Int!, $skip: Int!, $search: String, $userRole: UserRoleInput, $userRoleIds: [String])",
|
|
1065
|
+
field: "(limit: $limit, skip: $skip, search: $search, userRole: $userRole, userRoleIds: $userRoleIds)"
|
|
1066
|
+
},
|
|
1067
|
+
create: {
|
|
1068
|
+
operation: "mutation",
|
|
1069
|
+
name: "createUserRole",
|
|
1070
|
+
variables: "($userRole: UserRoleInput!)",
|
|
1071
|
+
field: "(userRole: $userRole)"
|
|
1072
|
+
},
|
|
1073
|
+
update: {
|
|
1074
|
+
operation: "mutation",
|
|
1075
|
+
name: "updateUserRole",
|
|
1076
|
+
variables: "($userRoleId: String!, $userRole: UserRoleInput!)",
|
|
1077
|
+
field: "(userRoleId: $userRoleId, userRole: $userRole)"
|
|
1078
|
+
},
|
|
1079
|
+
delete: {
|
|
1080
|
+
operation: "mutation",
|
|
1081
|
+
name: "removeUserRole",
|
|
1082
|
+
variables: "($userRoleId: String!)",
|
|
1083
|
+
field: "(userRoleId: $userRoleId)"
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/services/user/user-role.service.ts
|
|
1088
|
+
var createUserRoleService = (client) => ({
|
|
1089
|
+
createUserRole: createOperationExecutor(
|
|
1090
|
+
client,
|
|
1091
|
+
"createUserRole",
|
|
1092
|
+
{
|
|
1093
|
+
schema: buildSchema(userRoleSchema.create),
|
|
1094
|
+
defaultRootFields: userRoleIntegration.create.responseFields,
|
|
1095
|
+
defaultNestedFields: userRoleIntegration.create.nestedFields
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
updateUserRole: createOperationExecutor(
|
|
1099
|
+
client,
|
|
1100
|
+
"updateUserRole",
|
|
1101
|
+
{
|
|
1102
|
+
schema: buildSchema(userRoleSchema.update),
|
|
1103
|
+
defaultRootFields: userRoleIntegration.update.responseFields,
|
|
1104
|
+
defaultNestedFields: userRoleIntegration.update.nestedFields
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
1107
|
+
getUserRole: createOperationExecutor(
|
|
1108
|
+
client,
|
|
1109
|
+
"getUserRole",
|
|
1110
|
+
{
|
|
1111
|
+
schema: buildSchema(userRoleSchema.get),
|
|
1112
|
+
defaultRootFields: userRoleIntegration.get.responseFields,
|
|
1113
|
+
defaultNestedFields: userRoleIntegration.get.nestedFields
|
|
1114
|
+
}
|
|
1115
|
+
),
|
|
1116
|
+
removeUserRole: createOperationExecutor(
|
|
1117
|
+
client,
|
|
1118
|
+
"removeUserRole",
|
|
1119
|
+
{
|
|
1120
|
+
schema: buildSchema(userRoleSchema.delete),
|
|
1121
|
+
defaultRootFields: userRoleDeleteIntegration.responseFields,
|
|
1122
|
+
defaultNestedFields: {}
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
getUserRoles: createOperationExecutor(
|
|
1126
|
+
client,
|
|
1127
|
+
"getUserRoles",
|
|
1128
|
+
{
|
|
1129
|
+
schema: buildSchema(userRoleSchema.list),
|
|
1130
|
+
defaultRootFields: [...userRoleListIntegration.responseFields],
|
|
1131
|
+
defaultNestedFields: userRoleListIntegration.nestedFields
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
});
|
|
1135
|
+
|
|
835
1136
|
// src/services/inventory/types/product.type.ts
|
|
836
1137
|
var getCustomerProductCountsByIdsResponse = [
|
|
837
1138
|
"customersProductCounts"
|
|
@@ -2267,8 +2568,8 @@ var createTransactionService = (client) => ({
|
|
|
2267
2568
|
// src/services/subscription/schemas/paystack.schema.ts
|
|
2268
2569
|
var paystackSchema = {
|
|
2269
2570
|
paystackInitializeSubscription: (query) => `
|
|
2270
|
-
mutation paystackInitializeSubscription($userId: String!, $planId: String!) {
|
|
2271
|
-
paystackInitializeSubscription(userId: $userId, planId: $planId) {
|
|
2571
|
+
mutation paystackInitializeSubscription($userId: String!, $planId: String!, $subscriptionFrequencyType: SubscriptionFrequencyTypeEnum!) {
|
|
2572
|
+
paystackInitializeSubscription(userId: $userId, planId: $planId, subscriptionFrequencyType: $subscriptionFrequencyType) {
|
|
2272
2573
|
${query}
|
|
2273
2574
|
}
|
|
2274
2575
|
}
|
|
@@ -2829,7 +3130,9 @@ exports.createSubscriptionPlanService = createSubscriptionPlanService;
|
|
|
2829
3130
|
exports.createSubscriptionService = createSubscriptionService;
|
|
2830
3131
|
exports.createTransactionService = createTransactionService;
|
|
2831
3132
|
exports.createTransport = createTransport;
|
|
3133
|
+
exports.createUserAccountService = createUserAccountService;
|
|
2832
3134
|
exports.createUserNotificationService = createUserNotificationService;
|
|
3135
|
+
exports.createUserRoleService = createUserRoleService;
|
|
2833
3136
|
exports.createUserService = createUserService;
|
|
2834
3137
|
exports.getCustomerProductCountsByIdsResponse = getCustomerProductCountsByIdsResponse;
|
|
2835
3138
|
exports.getCustomerProductCountsByIdsResponseNestedFields = getCustomerProductCountsByIdsResponseNestedFields;
|