@connect-plus-online/ogabai-integrations 0.0.55 → 0.0.57
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 +325 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +150 -1
- package/dist/index.d.ts +150 -1
- package/dist/index.esm.js +324 -1
- 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",
|
|
@@ -608,6 +632,13 @@ var createUserService = (client) => ({
|
|
|
608
632
|
|
|
609
633
|
// src/services/user/schemas/auth.schema.ts
|
|
610
634
|
var authSchema = {
|
|
635
|
+
authenticateWithStore: (query) => `
|
|
636
|
+
mutation authenticateWithStore($storeId: String!, $roleId: String!) {
|
|
637
|
+
authenticateWithStore(storeId: $storeId, roleId: $roleId) {
|
|
638
|
+
${query}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
`,
|
|
611
642
|
// change pin
|
|
612
643
|
changePin: (query) => `
|
|
613
644
|
mutation changePin($userId: String!, $oldPin: String!, $newPin: String!) {
|
|
@@ -668,6 +699,9 @@ var authSchema = {
|
|
|
668
699
|
};
|
|
669
700
|
|
|
670
701
|
// src/services/user/types/auth.type.ts
|
|
702
|
+
var authenticateWithStoreResponse = [
|
|
703
|
+
"accessToken"
|
|
704
|
+
];
|
|
671
705
|
var checkRegistrationResponse = [
|
|
672
706
|
"isRegistered"
|
|
673
707
|
];
|
|
@@ -698,6 +732,18 @@ var signUpResponse = [
|
|
|
698
732
|
|
|
699
733
|
// src/services/user/auth.service.ts
|
|
700
734
|
var createAuthService = (client) => ({
|
|
735
|
+
async authenticateWithStore(input, fetchFields, option) {
|
|
736
|
+
var _a;
|
|
737
|
+
return client.request(
|
|
738
|
+
authSchema.authenticateWithStore(
|
|
739
|
+
gqlQueryStringBuilder(
|
|
740
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : authenticateWithStoreResponse
|
|
741
|
+
)
|
|
742
|
+
),
|
|
743
|
+
input,
|
|
744
|
+
option
|
|
745
|
+
);
|
|
746
|
+
},
|
|
701
747
|
async checkRegistration(input, fetchFields, option) {
|
|
702
748
|
var _a;
|
|
703
749
|
return client.request(
|
|
@@ -832,6 +878,283 @@ var createUserNotificationService = (client) => ({
|
|
|
832
878
|
}
|
|
833
879
|
});
|
|
834
880
|
|
|
881
|
+
// src/helpers/entity.factory.ts
|
|
882
|
+
function createEntityIntegration(config) {
|
|
883
|
+
var _a;
|
|
884
|
+
return {
|
|
885
|
+
responseFields: [config.key],
|
|
886
|
+
nestedFields: {
|
|
887
|
+
...(_a = config.nested) != null ? _a : {},
|
|
888
|
+
[config.key]: config.fields
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function createListIntegration(config) {
|
|
893
|
+
var _a;
|
|
894
|
+
return {
|
|
895
|
+
responseFields: [config.key, "total"],
|
|
896
|
+
nestedFields: {
|
|
897
|
+
...(_a = config.nested) != null ? _a : {},
|
|
898
|
+
[config.key]: config.fields
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
function createDeleteIntegration(key) {
|
|
903
|
+
const idKey = `${key}Id`;
|
|
904
|
+
return {
|
|
905
|
+
responseFields: [idKey]
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
function createStandardEntityIntegration(config) {
|
|
909
|
+
const base = createEntityIntegration(config);
|
|
910
|
+
return {
|
|
911
|
+
get: base,
|
|
912
|
+
create: base,
|
|
913
|
+
update: base
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// src/services/user/types/user-account.type.ts
|
|
918
|
+
var ENTITY = "userAccount";
|
|
919
|
+
var userAccountIntegration = createStandardEntityIntegration({
|
|
920
|
+
key: ENTITY,
|
|
921
|
+
fields: userAccountQuery,
|
|
922
|
+
nested: {
|
|
923
|
+
userAccount: userAccountQuery,
|
|
924
|
+
store: storeQuery,
|
|
925
|
+
privileges: privilegeQuery
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
var userAccountListIntegration = createListIntegration({
|
|
929
|
+
key: "userAccounts",
|
|
930
|
+
fields: userAccountQuery,
|
|
931
|
+
nested: {
|
|
932
|
+
privileges: privilegeQuery,
|
|
933
|
+
userAccount: userAccountQuery,
|
|
934
|
+
store: storeQuery
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
var userAccountDeleteIntegration = createDeleteIntegration(ENTITY);
|
|
938
|
+
|
|
939
|
+
// src/services/user/schemas/user-account.schema.ts
|
|
940
|
+
var userAccountSchema = {
|
|
941
|
+
get: {
|
|
942
|
+
operation: "query",
|
|
943
|
+
name: "getUserAccount",
|
|
944
|
+
variables: "($userAccount: UserAccountInput!)",
|
|
945
|
+
field: "(userAccount: $userAccount)"
|
|
946
|
+
},
|
|
947
|
+
list: {
|
|
948
|
+
operation: "query",
|
|
949
|
+
name: "getUserAccounts",
|
|
950
|
+
variables: "($limit: Int!, $skip: Int!, $search: String, $userAccount: UserAccountInput, $userAccountIds: [String])",
|
|
951
|
+
field: "(limit: $limit, skip: $skip, search: $search, userAccount: $userAccount, userAccountIds: $userAccountIds)"
|
|
952
|
+
},
|
|
953
|
+
create: {
|
|
954
|
+
operation: "mutation",
|
|
955
|
+
name: "createUserAccount",
|
|
956
|
+
variables: "($userAccount: UserAccountInput!)",
|
|
957
|
+
field: "(userAccount: $userAccount)"
|
|
958
|
+
},
|
|
959
|
+
update: {
|
|
960
|
+
operation: "mutation",
|
|
961
|
+
name: "updateUserAccount",
|
|
962
|
+
variables: "($userAccountId: String!, $userAccount: UserAccountInput!)",
|
|
963
|
+
field: "(userAccountId: $userAccountId, userAccount: $userAccount)"
|
|
964
|
+
},
|
|
965
|
+
delete: {
|
|
966
|
+
operation: "mutation",
|
|
967
|
+
name: "removeUserAccount",
|
|
968
|
+
variables: "($userAccountId: String!)",
|
|
969
|
+
field: "(userAccountId: $userAccountId)"
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
// src/helpers/service.factory.ts
|
|
974
|
+
function createOperationExecutor(client, key, config) {
|
|
975
|
+
return async (input, fetchFields, option) => {
|
|
976
|
+
var _a, _b, _c;
|
|
977
|
+
const query = config.schema(
|
|
978
|
+
gqlQueryStringBuilder(
|
|
979
|
+
(_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : config.defaultRootFields,
|
|
980
|
+
(_b = fetchFields == null ? void 0 : fetchFields.nestedFields) != null ? _b : config.defaultNestedFields
|
|
981
|
+
)
|
|
982
|
+
);
|
|
983
|
+
const res = await client.request(
|
|
984
|
+
query,
|
|
985
|
+
input,
|
|
986
|
+
option
|
|
987
|
+
);
|
|
988
|
+
return (_c = res.data) == null ? void 0 : _c[key];
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// src/helpers/schema-builder.ts
|
|
993
|
+
function buildSchema({
|
|
994
|
+
operation,
|
|
995
|
+
name,
|
|
996
|
+
variables,
|
|
997
|
+
field
|
|
998
|
+
}) {
|
|
999
|
+
return (selection) => `
|
|
1000
|
+
${operation} ${name}${variables} {
|
|
1001
|
+
${name}${field} {
|
|
1002
|
+
${selection}
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
`.trim();
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// src/services/user/user-account.service.ts
|
|
1009
|
+
var createUserAccountService = (client) => ({
|
|
1010
|
+
createUserAccount: createOperationExecutor(
|
|
1011
|
+
client,
|
|
1012
|
+
"createUserAccount",
|
|
1013
|
+
{
|
|
1014
|
+
schema: buildSchema(userAccountSchema.create),
|
|
1015
|
+
defaultRootFields: userAccountIntegration.create.responseFields,
|
|
1016
|
+
defaultNestedFields: userAccountIntegration.create.nestedFields
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
updateUserAccount: createOperationExecutor(
|
|
1020
|
+
client,
|
|
1021
|
+
"updateUserAccount",
|
|
1022
|
+
{
|
|
1023
|
+
schema: buildSchema(userAccountSchema.update),
|
|
1024
|
+
defaultRootFields: userAccountIntegration.update.responseFields,
|
|
1025
|
+
defaultNestedFields: userAccountIntegration.update.nestedFields
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
getUserAccount: createOperationExecutor(
|
|
1029
|
+
client,
|
|
1030
|
+
"getUserAccount",
|
|
1031
|
+
{
|
|
1032
|
+
schema: buildSchema(userAccountSchema.get),
|
|
1033
|
+
defaultRootFields: userAccountIntegration.get.responseFields,
|
|
1034
|
+
defaultNestedFields: userAccountIntegration.get.nestedFields
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
removeUserAccount: createOperationExecutor(
|
|
1038
|
+
client,
|
|
1039
|
+
"removeUserAccount",
|
|
1040
|
+
{
|
|
1041
|
+
schema: buildSchema(userAccountSchema.delete),
|
|
1042
|
+
defaultRootFields: userAccountDeleteIntegration.responseFields,
|
|
1043
|
+
defaultNestedFields: {}
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
getUserAccounts: createOperationExecutor(
|
|
1047
|
+
client,
|
|
1048
|
+
"getUserAccounts",
|
|
1049
|
+
{
|
|
1050
|
+
schema: buildSchema(userAccountSchema.list),
|
|
1051
|
+
defaultRootFields: [...userAccountListIntegration.responseFields],
|
|
1052
|
+
defaultNestedFields: userAccountListIntegration.nestedFields
|
|
1053
|
+
}
|
|
1054
|
+
)
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// src/services/user/types/user-role.type.ts
|
|
1058
|
+
var ENTITY2 = "userRole";
|
|
1059
|
+
var userRoleIntegration = createStandardEntityIntegration({
|
|
1060
|
+
key: ENTITY2,
|
|
1061
|
+
fields: userRoleQuery,
|
|
1062
|
+
nested: {
|
|
1063
|
+
privileges: privilegeQuery
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
var userRoleListIntegration = createListIntegration({
|
|
1067
|
+
key: "userRoles",
|
|
1068
|
+
fields: userRoleQuery,
|
|
1069
|
+
nested: {
|
|
1070
|
+
privileges: privilegeQuery
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
var userRoleDeleteIntegration = createDeleteIntegration(ENTITY2);
|
|
1074
|
+
|
|
1075
|
+
// src/services/user/schemas/user-role.schema.ts
|
|
1076
|
+
var userRoleSchema = {
|
|
1077
|
+
get: {
|
|
1078
|
+
operation: "query",
|
|
1079
|
+
name: "getUserRole",
|
|
1080
|
+
variables: "($userRole: UserRoleInput!)",
|
|
1081
|
+
field: "(userRole: $userRole)"
|
|
1082
|
+
},
|
|
1083
|
+
list: {
|
|
1084
|
+
operation: "query",
|
|
1085
|
+
name: "getUserRoles",
|
|
1086
|
+
variables: "($limit: Int!, $skip: Int!, $search: String, $userRole: UserRoleInput, $userRoleIds: [String])",
|
|
1087
|
+
field: "(limit: $limit, skip: $skip, search: $search, userRole: $userRole, userRoleIds: $userRoleIds)"
|
|
1088
|
+
},
|
|
1089
|
+
create: {
|
|
1090
|
+
operation: "mutation",
|
|
1091
|
+
name: "createUserRole",
|
|
1092
|
+
variables: "($userRole: UserRoleInput!)",
|
|
1093
|
+
field: "(userRole: $userRole)"
|
|
1094
|
+
},
|
|
1095
|
+
update: {
|
|
1096
|
+
operation: "mutation",
|
|
1097
|
+
name: "updateUserRole",
|
|
1098
|
+
variables: "($userRoleId: String!, $userRole: UserRoleInput!)",
|
|
1099
|
+
field: "(userRoleId: $userRoleId, userRole: $userRole)"
|
|
1100
|
+
},
|
|
1101
|
+
delete: {
|
|
1102
|
+
operation: "mutation",
|
|
1103
|
+
name: "removeUserRole",
|
|
1104
|
+
variables: "($userRoleId: String!)",
|
|
1105
|
+
field: "(userRoleId: $userRoleId)"
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
|
|
1109
|
+
// src/services/user/user-role.service.ts
|
|
1110
|
+
var createUserRoleService = (client) => ({
|
|
1111
|
+
createUserRole: createOperationExecutor(
|
|
1112
|
+
client,
|
|
1113
|
+
"createUserRole",
|
|
1114
|
+
{
|
|
1115
|
+
schema: buildSchema(userRoleSchema.create),
|
|
1116
|
+
defaultRootFields: userRoleIntegration.create.responseFields,
|
|
1117
|
+
defaultNestedFields: userRoleIntegration.create.nestedFields
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
updateUserRole: createOperationExecutor(
|
|
1121
|
+
client,
|
|
1122
|
+
"updateUserRole",
|
|
1123
|
+
{
|
|
1124
|
+
schema: buildSchema(userRoleSchema.update),
|
|
1125
|
+
defaultRootFields: userRoleIntegration.update.responseFields,
|
|
1126
|
+
defaultNestedFields: userRoleIntegration.update.nestedFields
|
|
1127
|
+
}
|
|
1128
|
+
),
|
|
1129
|
+
getUserRole: createOperationExecutor(
|
|
1130
|
+
client,
|
|
1131
|
+
"getUserRole",
|
|
1132
|
+
{
|
|
1133
|
+
schema: buildSchema(userRoleSchema.get),
|
|
1134
|
+
defaultRootFields: userRoleIntegration.get.responseFields,
|
|
1135
|
+
defaultNestedFields: userRoleIntegration.get.nestedFields
|
|
1136
|
+
}
|
|
1137
|
+
),
|
|
1138
|
+
removeUserRole: createOperationExecutor(
|
|
1139
|
+
client,
|
|
1140
|
+
"removeUserRole",
|
|
1141
|
+
{
|
|
1142
|
+
schema: buildSchema(userRoleSchema.delete),
|
|
1143
|
+
defaultRootFields: userRoleDeleteIntegration.responseFields,
|
|
1144
|
+
defaultNestedFields: {}
|
|
1145
|
+
}
|
|
1146
|
+
),
|
|
1147
|
+
getUserRoles: createOperationExecutor(
|
|
1148
|
+
client,
|
|
1149
|
+
"getUserRoles",
|
|
1150
|
+
{
|
|
1151
|
+
schema: buildSchema(userRoleSchema.list),
|
|
1152
|
+
defaultRootFields: [...userRoleListIntegration.responseFields],
|
|
1153
|
+
defaultNestedFields: userRoleListIntegration.nestedFields
|
|
1154
|
+
}
|
|
1155
|
+
)
|
|
1156
|
+
});
|
|
1157
|
+
|
|
835
1158
|
// src/services/inventory/types/product.type.ts
|
|
836
1159
|
var getCustomerProductCountsByIdsResponse = [
|
|
837
1160
|
"customersProductCounts"
|
|
@@ -2829,7 +3152,9 @@ exports.createSubscriptionPlanService = createSubscriptionPlanService;
|
|
|
2829
3152
|
exports.createSubscriptionService = createSubscriptionService;
|
|
2830
3153
|
exports.createTransactionService = createTransactionService;
|
|
2831
3154
|
exports.createTransport = createTransport;
|
|
3155
|
+
exports.createUserAccountService = createUserAccountService;
|
|
2832
3156
|
exports.createUserNotificationService = createUserNotificationService;
|
|
3157
|
+
exports.createUserRoleService = createUserRoleService;
|
|
2833
3158
|
exports.createUserService = createUserService;
|
|
2834
3159
|
exports.getCustomerProductCountsByIdsResponse = getCustomerProductCountsByIdsResponse;
|
|
2835
3160
|
exports.getCustomerProductCountsByIdsResponseNestedFields = getCustomerProductCountsByIdsResponseNestedFields;
|