storemw-core-api 1.0.153 → 1.0.155
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/features/index.d.ts +1 -1
- package/dist/features/index.js.map +1 -1
- package/dist/features/user_me/userMeRegistry.js +4 -0
- package/dist/features/user_me/userMeRegistry.js.map +1 -1
- package/dist/features/user_me/userMeType.d.ts +17 -3
- package/dist/features/user_me/userMeType.js.map +1 -1
- package/dist/services/access_control/AccessControlRoleService.js +1 -1
- package/dist/services/access_control/AccessControlRoleService.js.map +1 -1
- package/dist/services/access_key/AccessKeyService.js +1 -1
- package/dist/services/access_key/AccessKeyService.js.map +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/account/AccountService.js.map +1 -1
- package/dist/services/auth/AuthService.js +2 -2
- package/dist/services/auth/AuthService.js.map +1 -1
- package/dist/services/business/BusinessService.js +1 -1
- package/dist/services/business/BusinessService.js.map +1 -1
- package/dist/services/file/FileService.js +4 -4
- package/dist/services/file/FileService.js.map +1 -1
- package/dist/services/gateway/SmtpEmailService.js +5 -4
- package/dist/services/gateway/SmtpEmailService.js.map +1 -1
- package/dist/services/injection_field/InjectionFieldService.js +1 -1
- package/dist/services/injection_field/InjectionFieldService.js.map +1 -1
- package/dist/services/item/ItemBrandService.js +1 -1
- package/dist/services/item/ItemBrandService.js.map +1 -1
- package/dist/services/item/ItemCategoryService.js +1 -1
- package/dist/services/item/ItemCategoryService.js.map +1 -1
- package/dist/services/item/ItemItemService.js +1 -1
- package/dist/services/item/ItemItemService.js.map +1 -1
- package/dist/services/item/ItemProductService.js +1 -1
- package/dist/services/item/ItemProductService.js.map +1 -1
- package/dist/services/item/ItemUomService.js +1 -1
- package/dist/services/item/ItemUomService.js.map +1 -1
- package/dist/services/location/LocationLocationService.js +1 -1
- package/dist/services/location/LocationLocationService.js.map +1 -1
- package/dist/services/location/LocationRackService.js +1 -1
- package/dist/services/location/LocationRackService.js.map +1 -1
- package/dist/services/location/LocationSlotService.js +1 -1
- package/dist/services/location/LocationSlotService.js.map +1 -1
- package/dist/services/one_time_code/OneTimeCodeService.js +1 -1
- package/dist/services/one_time_code/OneTimeCodeService.js.map +1 -1
- package/dist/services/region/AreaService.js +1 -1
- package/dist/services/region/AreaService.js.map +1 -1
- package/dist/services/region/CountryService.js +1 -1
- package/dist/services/region/CountryService.js.map +1 -1
- package/dist/services/region/StateService.js +1 -1
- package/dist/services/region/StateService.js.map +1 -1
- package/dist/services/reset_password/ResetPasswordService.js +4 -4
- package/dist/services/reset_password/ResetPasswordService.js.map +1 -1
- package/dist/services/scheduler/SchedulerLogService.js +1 -1
- package/dist/services/scheduler/SchedulerLogService.js.map +1 -1
- package/dist/services/subscription/account/AccountSubscribeService.js +1 -1
- package/dist/services/subscription/account/AccountSubscribeService.js.map +1 -1
- package/dist/services/subscription/plan/SubscribePlanService.js +1 -1
- package/dist/services/subscription/plan/SubscribePlanService.js.map +1 -1
- package/dist/services/user/AdministratorService.js +1 -1
- package/dist/services/user/AdministratorService.js.map +1 -1
- package/dist/services/user/AgentService.js +1 -1
- package/dist/services/user/AgentService.js.map +1 -1
- package/dist/services/user/CustomerService.js +1 -1
- package/dist/services/user/CustomerService.js.map +1 -1
- package/dist/services/user/DriverService.js +1 -1
- package/dist/services/user/DriverService.js.map +1 -1
- package/dist/services/user/MemberService.js +1 -1
- package/dist/services/user/MemberService.js.map +1 -1
- package/dist/services/user/OperatorService.js +1 -1
- package/dist/services/user/OperatorService.js.map +1 -1
- package/dist/services/user/RetailerService.js +1 -1
- package/dist/services/user/RetailerService.js.map +1 -1
- package/dist/services/user/UserMeService.js +29 -8
- package/dist/services/user/UserMeService.js.map +1 -1
- package/dist/services/user/UserService.js +1 -1
- package/dist/services/user/UserService.js.map +1 -1
- package/dist/services/user/WorkerService.js +1 -1
- package/dist/services/user/WorkerService.js.map +1 -1
- package/dist/utils/featureUtils.d.ts +3 -0
- package/dist/utils/featureUtils.js +11 -0
- package/dist/utils/featureUtils.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/serviceUtils.d.ts +1 -0
- package/dist/utils/serviceUtils.js +2 -1
- package/dist/utils/serviceUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerService.js","sourceRoot":"","sources":["../../../src/services/user/WorkerService.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,qCAOkB;AAElB,yCAAwE;AAMxE,+BAA4K;AAI/J,QAAA,eAAe,GAAG;IAC3B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,gBAAgB;IAC/B,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,YAAY;IACvB,qBAAqB,EAAE,yBAAyB;IAChD,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,aAAa;CAC5B,CAAA;AA4CD,MAAM,gBAAgB,GAAG,CAAC,IAA+B,EAAE,EAAE;IAEzD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QAEnB,OAAO;YACH,CAAC,GAAG,0BAAiB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YACpD,CAAC,GAAG,0BAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;SACtD,CAAA;IACL,CAAC;IAED,OAAO,KAAK,CAAA;AAEhB,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,IAA+B,EAAE,EAAE;IAEzD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QAEnB,OAAO;YACH,wDAAwD;YACxD,CAAC,GAAG,0BAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;SACtD,CAAA;IACL,CAAC;IAED,OAAO,KAAK,CAAA;AAEhB,CAAC,CAAA;AAED,IAAI,aAAa,GAAG;IAChB,CAAC,OA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AC,CAAC,CAAC;SAC1D,CAAA;QAED,OAAO,QAAQ,CAAA;IAEnB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,KAAK,EAAE,EAAE,OAAO,EAAqB,EAAE,EAAE;QAE3D,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;QAEvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,0BAAiB,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7G,OAAO,QAAQ,CAAA;IACnB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,GAAG,EAAE;QACtB,OAAO,MAAM,CAAC,MAAM,CAAC,uBAAe,CAAC,CAAC;IAC1C,CAAC,CAAA;IAED,OAAO;QACH,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,aAAa;QACb,YAAY;KACf,CAAA;AAEL,CAAC,CAAA;AApPY,QAAA,aAAa,iBAoPzB","sourcesContent":["import { logError, throwError } from \"@/utils\";\n\nimport {\n ModelUserFields,\n WorkerModel,\n ModelWorkerFields,\n ModelUserPropFields,\n ModelLocationFields,\n UserInjectionFieldModel\n} from \"@/models\";\n\nimport { InjectionFieldService, userParentSqlSelect } from \"@/services\";\n\nimport { QueryList, QueryGet } from \"@/schema/common\";\n\nimport { DefaultServiceProps } from \"@/utils\";\n\nimport { toFieldMap, buildSqlRawSelect, buildSqlRelation, buildSqlWhere, buildSqlSelect, buildSqlLimitOffset, buildSqlOrderBy, buildInjectionFieldsSqlSelect } from \"@/lib\";\n\nexport type UserType = \"worker\"\n\nexport const workerDataTypes = {\n location: \"location\",\n locationCount: \"location_count\",\n zone: \"zone\",\n zoneCount: \"zone_count\",\n workerInjectionFields: \"worker_injection_fields\",\n file: \"file\",\n parentUser: \"parent_user\"\n}\n\nexport type WorkerDataType = keyof typeof workerDataTypes;\n\nexport type WorkerServiceProps = DefaultServiceProps & {};\n\nexport type WorkerGetProps = {\n id: number,\n includePassword?: boolean,\n datatypes: WorkerDataType[]\n};\n\nexport type WorkerListProps = QueryList & {\n includePassword?: boolean,\n datatypes: WorkerDataType[]\n};\n\nexport type WorkerRemoveProps = {\n userIds: BigInt[]\n};\n\nexport type WorkerCreateProps = {\n data:\n // worker\n {\n worker: {\n userId: number,\n remark: string\n }\n }\n}\n\nexport type WorkerUpdateProps = {\n userId: number,\n data:\n // worker\n {\n worker: {\n // userId: number,\n remark: string\n }\n }\n}\n\nconst getCreatePayload = (data: WorkerCreateProps[\"data\"]) => {\n\n if (\"worker\" in data) {\n\n return {\n [`${ModelWorkerFields.user_id}`]: data.worker.userId,\n [`${ModelWorkerFields.remark}`]: data.worker.remark\n }\n }\n\n return false\n\n}\n\nconst getUpdatePayload = (data: WorkerUpdateProps[\"data\"]) => {\n\n if (\"worker\" in data) {\n\n return {\n // [`${ModelWorkerFields.user_id}`]: data.worker.userId,\n [`${ModelWorkerFields.remark}`]: data.worker.remark\n }\n }\n\n return false\n\n}\n\nlet mainSqlSelect = {\n [`wrk.${ModelWorkerFields.worker_id}`]: \"worker_id\",\n [`wrk.${ModelWorkerFields.user_id}`]: \"user_id\",\n [`wrk.${ModelWorkerFields.remark}`]: \"remark\",\n}\n\nlet userSqlSelect = {\n [`usr.${ModelUserFields.login_username}`]: \"username\",\n [`usr.${ModelUserFields.user_type}`]: \"user_type\",\n [`usr.${ModelUserFields.firstname}`]: \"firstname\",\n [`usr.${ModelUserFields.lastname}`]: \"lastname\",\n [`CONCAT(usr.${ModelUserFields.contact_country_code}, usr.${ModelUserFields.contact_phone_number})`]: \"contact\",\n [`usr.${ModelUserFields.contact_country_code}`]: \"contact_country_code\",\n [`usr.${ModelUserFields.contact_phone_number}`]: \"contact_phone_number\",\n [`usr.${ModelUserFields.email}`]: \"email\",\n [`usr.${ModelUserFields.address}`]: \"address\",\n [`usr.${ModelUserFields.parent_user_id}`]: \"parent_user_id\",\n [`usr.${ModelUserFields.status}`]: \"status\"\n}\n\nlet defaultSqlSelect = {\n [`wrk.${ModelWorkerFields.createdatetime} `]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username} `]: \"createusername\",\n [`wrk.${ModelWorkerFields.updatedatetime} `]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username} `]: \"updateusername\",\n [`wrk.${ModelWorkerFields.isdelete} `]: \"isdelete\",\n [`wrk.${ModelWorkerFields.istrash} `]: \"istrash\",\n [`wrk.${ModelWorkerFields.accountid} `]: \"accountid\",\n}\n\nlet userPropLocationSqlSelect = {\n [`COALESCE(\n STRING_AGG(usrprop_location.${ModelUserPropFields.props_id}:: text, ', '),\n ''\n)`]: \"location_id\",\n [`COALESCE(\n STRING_AGG(location.${ModelLocationFields.location_name}:: text, ', '),\n ''\n)`]: \"location_name\",\n}\n\nexport const WorkerService = (props: WorkerServiceProps) => {\n\n const {\n ...rest\n } = props\n\n const workerModel = WorkerModel({ ...rest })\n\n const injectionFieldService = InjectionFieldService({ ...rest, injectionFieldType: \"user\" })\n\n // const userInjectionFieldModel = UserInjectionFieldModel({ ...rest })\n\n const createWorker = async ({ data }: WorkerCreateProps) => {\n\n const _data = getCreatePayload(data)\n\n if (!_data) {\n throw new Error(`Invalid create worker payload: ${JSON.stringify(_data)} `);\n }\n\n let response = await workerModel.create({ data: _data })\n\n return response\n }\n\n const updateWorker = async ({ userId, data }: WorkerUpdateProps) => {\n\n const _data = getUpdatePayload(data)\n\n if (!_data) {\n throw new Error(`Invalid update worker payload: ${JSON.stringify(_data)} `);\n }\n\n let response = await workerModel.update({ where: { [`${ModelWorkerFields.user_id} `]: userId }, data: _data })\n\n return response\n }\n\n const getWorker = async ({ id, datatypes = [], includePassword = false }: WorkerGetProps) => {\n\n let { data } = await listWorkers({\n includePassword,\n limit: 1,\n offset: 0,\n filters: [{ field: \"user_id\", operator: \"=\", value: id }],\n sortfield: \"user_id\",\n sortorder: \"ASC\",\n datatypes\n })\n\n return data[0] ?? null;\n\n };\n\n const listWorkers = async ({\n includePassword = false,\n limit,\n offset,\n filters,\n sortfield,\n sortorder,\n datatypes = []\n }: WorkerListProps) => {\n\n let data = []\n\n if (includePassword === true) {\n userSqlSelect = {\n ...userSqlSelect,\n [`usr.${ModelUserFields.login_password} `]: \"password\",\n }\n } else {\n delete userSqlSelect[`usr.${ModelUserFields.login_password} `];\n }\n\n let sqlSelect = [\n `COUNT(wrk.*) OVER() as filtered_count`,\n buildSqlSelect(``, mainSqlSelect),\n buildSqlSelect(``, userSqlSelect),\n buildSqlSelect(``, defaultSqlSelect),\n buildSqlSelect(``, userPropLocationSqlSelect),\n ]\n\n let sqlRelation = [\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"usr\", [\"wrk.user_id = usr.user_id\", \"usr.isdelete = false\", \"usr.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"creator\", [\"wrk.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"updater\", [\"wrk.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"user_props\", \"usrprop_location\", [\"wrk.user_id = usrprop_location.user_id\", \"usrprop_location.type = 'LOCATION_ID'\", \"usrprop_location.isdelete = false\", \"usrprop_location.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"locations\", \"location\", [\"usrprop_location.props_id = location.location_id\", \"location.isdelete = false\", \"location.istrash = false\"]),\n ]\n\n let sqlGroupBy: string[] = [\n ...Object.keys(mainSqlSelect),\n ...Object.keys(userSqlSelect),\n // ...Object.keys(userPropLocationSqlSelect),\n ...Object.keys(defaultSqlSelect)\n ]\n\n let filterColumns = {\n ...mainSqlSelect,\n ...userSqlSelect,\n ...userPropLocationSqlSelect,\n ...defaultSqlSelect\n }\n\n if (datatypes.includes(workerDataTypes.workerInjectionFields)) {\n\n let activeInjectionFields = await injectionFieldService.listActiveInjectionFields(\"user\", \"worker\")\n\n const workerInjectionFieldSqlSelect = buildInjectionFieldsSqlSelect(\"uif\", activeInjectionFields)\n\n filterColumns = { ...filterColumns, ...workerInjectionFieldSqlSelect }\n\n sqlSelect = [...sqlSelect, ...(activeInjectionFields.length > 0 ? [buildSqlSelect(``, workerInjectionFieldSqlSelect)] : [])]\n sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"wrk\", \"user_injection_fields\", \"uif\", [\"wrk.user_id = uif.user_id\", \"uif.field_ref = 'user'\", \"uif.field_module = 'worker'\", \"uif.isdelete = false\", \"uif.istrash = false\"])]\n sqlGroupBy = [...sqlGroupBy, ...Object.keys(workerInjectionFieldSqlSelect)]\n\n }\n\n if (datatypes.includes(workerDataTypes.parentUser)) {\n\n filterColumns = { ...filterColumns, ...userParentSqlSelect }\n\n sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"wrk\", \"users\", \"parentuser\", [\"usr.parent_user_id = parentuser.user_id\", \"parentuser.isdelete = false\", \"parentuser.istrash = false\"])]\n sqlSelect = [...sqlSelect, buildSqlSelect(``, userParentSqlSelect)]\n sqlGroupBy = [...sqlGroupBy, ...Object.keys(userParentSqlSelect)]\n\n }\n\n if (datatypes.includes(workerDataTypes.location)) {\n\n let locationSqlSelect = {\n [`COALESCE(\n JSON_AGG(\n DISTINCT JSONB_BUILD_OBJECT(\n '${ModelLocationFields.location_id}', location.location_id,\n '${ModelLocationFields.location_code}', location.location_code,\n '${ModelLocationFields.location_name}', location.location_name,\n '${ModelLocationFields.location_type}', location.location_type,\n '${ModelLocationFields.address_1}', location.address_1,\n '${ModelLocationFields.address_2}', location.address_2,\n '${ModelLocationFields.area_id}', location.area_id,\n '${ModelLocationFields.country_id}', location.country_id,\n '${ModelLocationFields.state_id}', location.state_id,\n '${ModelLocationFields.postcode}', location.postcode,\n '${ModelLocationFields.is_default}', location.is_default,\n '${ModelLocationFields.person_contact}', location.person_contact,\n '${ModelLocationFields.person_name}', location.person_contact,\n '${ModelLocationFields.person_email}', location.person_email,\n '${ModelLocationFields.isdelete}', location.isdelete,\n '${ModelLocationFields.istrash}', location.istrash\n )\n ) FILTER(WHERE location.location_id IS NOT NULL AND location.isdelete = false AND location.istrash = false),\n '[]'\n )`]: \"locations\"\n }\n\n filterColumns = { ...filterColumns, ...locationSqlSelect }\n\n sqlSelect = [...sqlSelect, buildSqlSelect(``, locationSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"usrprop_location\", \"location\", \"brn\", [\"wrk.user_id = brn.user_id\", \"brn.isdelete = false\", \"brn.istrash = false\"])]\n\n }\n\n if (datatypes.includes(workerDataTypes.locationCount)) {\n\n let locationCountSqlSelect = {\n [`COUNT(DISTINCT location.${ModelLocationFields.location_id}):: INT`]: \"location_count\"\n }\n\n filterColumns = { ...filterColumns, ...locationCountSqlSelect }\n\n sqlSelect = [...sqlSelect, buildSqlSelect(``, locationCountSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"cus\", \"branches\", \"brncount\", [\"wrk.user_id = brncount.user_id\", \"brncount.isdelete = false\", \"brncount.istrash = false\"])]\n\n }\n\n // if (datatypes.includes(customerDataTypes.branchUserCount)) {\n\n // let branchUserCountSqlSelect = {\n // [`COUNT(DISTINCT brnusrcount.${ ModelBranchUserFields.branch_user_id }):: INT`]: \"branch_user_count\"\n // }\n\n // filterColumns = { ...filterColumns, ...branchUserCountSqlSelect }\n\n // sqlSelect = [...sqlSelect, buildSqlSelect(``, branchUserCountSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"cus\", \"branch_users\", \"brnusrcount\", [\"wrk.user_id = brnusrcount.user_id\", \"brnusrcount.isdelete = false\", \"brnusrcount.istrash = false\"])]\n\n // }\n\n let sqlWhere = [\n `wrk.isdelete = false`,\n `wrk.istrash = false`,\n ...(filters.length ? [buildSqlWhere(filters, filterColumns)?.where] : []),\n ]\n\n let sqlOrderby = buildSqlOrderBy(sortfield, sortorder)\n let sqlLimitOffset = buildSqlLimitOffset(limit, offset)\n\n const sqlRaw = buildSqlRawSelect({\n tableName: \"workers\",\n mainAlias: \"wrk\",\n accountId: rest.accountId,\n sqlSelect,\n sqlRelation,\n sqlWhere,\n sqlGroupBy,\n sqlOrderby,\n sqlLimitOffset\n })\n\n data = await workerModel.raw(sqlRaw)\n\n const response = {\n data: data.map(({ filtered_count, ...rest }) => rest),\n total: data.length ? Number(data[0].filtered_count) : 0\n }\n\n return response\n\n };\n\n const removeWorkers = async ({ userIds }: WorkerRemoveProps) => {\n\n if (!userIds.length) throwError('userIds is required');\n\n const response = await workerModel.remove({ where: { [`${ModelWorkerFields.user_id} `]: { in: userIds } } });\n\n return response\n };\n\n const getDataTypes = () => {\n return Object.values(workerDataTypes);\n }\n\n return {\n createWorker,\n updateWorker,\n getWorker,\n listWorkers,\n removeWorkers,\n getDataTypes\n }\n\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"WorkerService.js","sourceRoot":"","sources":["../../../src/services/user/WorkerService.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,qCAOkB;AAElB,yCAAwE;AAMxE,+BAA4K;AAI/J,QAAA,eAAe,GAAG;IAC3B,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,gBAAgB;IAC/B,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,YAAY;IACvB,qBAAqB,EAAE,yBAAyB;IAChD,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,aAAa;CAC5B,CAAA;AA4CD,MAAM,gBAAgB,GAAG,CAAC,IAA+B,EAAE,EAAE;IAEzD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QAEnB,OAAO;YACH,CAAC,GAAG,0BAAiB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YACpD,CAAC,GAAG,0BAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,IAA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SAAS;YACT,WAAW;YACX,QAAQ;YACR,UAAU;YACV,UAAU;YACV,cAAc;SACjB,CAAC,CAAA;QAEF,IAAI,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAEpC,MAAM,QAAQ,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC;YACrD,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1D,CAAA;QAED,OAAO,QAAQ,CAAA;IAEnB,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,KAAK,EAAE,EAAE,OAAO,EAAqB,EAAE,EAAE;QAE3D,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,IAAA,kBAAU,EAAC,qBAAqB,CAAC,CAAC;QAEvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,0BAAiB,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7G,OAAO,QAAQ,CAAA;IACnB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,GAAG,EAAE;QACtB,OAAO,MAAM,CAAC,MAAM,CAAC,uBAAe,CAAC,CAAC;IAC1C,CAAC,CAAA;IAED,OAAO;QACH,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,WAAW;QACX,aAAa;QACb,YAAY;KACf,CAAA;AAEL,CAAC,CAAA;AApPY,QAAA,aAAa,iBAoPzB","sourcesContent":["import { logError, throwError } from \"@/utils\";\n\nimport {\n ModelUserFields,\n WorkerModel,\n ModelWorkerFields,\n ModelUserPropFields,\n ModelLocationFields,\n UserInjectionFieldModel\n} from \"@/models\";\n\nimport { InjectionFieldService, userParentSqlSelect } from \"@/services\";\n\nimport { QueryList, QueryGet } from \"@/schema/common\";\n\nimport { DefaultServiceProps } from \"@/utils\";\n\nimport { toFieldMap, buildSqlRawSelect, buildSqlRelation, buildSqlWhere, buildSqlSelect, buildSqlLimitOffset, buildSqlOrderBy, buildInjectionFieldsSqlSelect } from \"@/lib\";\n\nexport type UserType = \"worker\"\n\nexport const workerDataTypes = {\n location: \"location\",\n locationCount: \"location_count\",\n zone: \"zone\",\n zoneCount: \"zone_count\",\n workerInjectionFields: \"worker_injection_fields\",\n file: \"file\",\n parentUser: \"parent_user\"\n}\n\nexport type WorkerDataType = keyof typeof workerDataTypes;\n\nexport type WorkerServiceProps = DefaultServiceProps & {};\n\nexport type WorkerGetProps = {\n id: number,\n includePassword?: boolean,\n datatypes: WorkerDataType[]\n};\n\nexport type WorkerListProps = QueryList & {\n includePassword?: boolean,\n datatypes: WorkerDataType[]\n};\n\nexport type WorkerRemoveProps = {\n userIds: BigInt[]\n};\n\nexport type WorkerCreateProps = {\n data:\n // worker\n {\n worker: {\n userId: number,\n remark: string\n }\n }\n}\n\nexport type WorkerUpdateProps = {\n userId: number,\n data:\n // worker\n {\n worker: {\n // userId: number,\n remark: string\n }\n }\n}\n\nconst getCreatePayload = (data: WorkerCreateProps[\"data\"]) => {\n\n if (\"worker\" in data) {\n\n return {\n [`${ModelWorkerFields.user_id}`]: data.worker.userId,\n [`${ModelWorkerFields.remark}`]: data.worker.remark\n }\n }\n\n return false\n\n}\n\nconst getUpdatePayload = (data: WorkerUpdateProps[\"data\"]) => {\n\n if (\"worker\" in data) {\n\n return {\n // [`${ModelWorkerFields.user_id}`]: data.worker.userId,\n [`${ModelWorkerFields.remark}`]: data.worker.remark\n }\n }\n\n return false\n\n}\n\nlet mainSqlSelect = {\n [`wrk.${ModelWorkerFields.worker_id}`]: \"worker_id\",\n [`wrk.${ModelWorkerFields.user_id}`]: \"user_id\",\n [`wrk.${ModelWorkerFields.remark}`]: \"remark\",\n}\n\nlet userSqlSelect = {\n [`usr.${ModelUserFields.login_username}`]: \"username\",\n [`usr.${ModelUserFields.user_type}`]: \"user_type\",\n [`usr.${ModelUserFields.firstname}`]: \"firstname\",\n [`usr.${ModelUserFields.lastname}`]: \"lastname\",\n [`CONCAT(usr.${ModelUserFields.contact_country_code}, usr.${ModelUserFields.contact_phone_number})`]: \"contact\",\n [`usr.${ModelUserFields.contact_country_code}`]: \"contact_country_code\",\n [`usr.${ModelUserFields.contact_phone_number}`]: \"contact_phone_number\",\n [`usr.${ModelUserFields.email}`]: \"email\",\n [`usr.${ModelUserFields.address}`]: \"address\",\n [`usr.${ModelUserFields.parent_user_id}`]: \"parent_user_id\",\n [`usr.${ModelUserFields.status}`]: \"status\"\n}\n\nlet defaultSqlSelect = {\n [`wrk.${ModelWorkerFields.createdatetime} `]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username} `]: \"createusername\",\n [`wrk.${ModelWorkerFields.updatedatetime} `]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username} `]: \"updateusername\",\n [`wrk.${ModelWorkerFields.isdelete} `]: \"isdelete\",\n [`wrk.${ModelWorkerFields.istrash} `]: \"istrash\",\n [`wrk.${ModelWorkerFields.accountid} `]: \"accountid\",\n}\n\nlet userPropLocationSqlSelect = {\n [`COALESCE(\n STRING_AGG(usrprop_location.${ModelUserPropFields.props_id}:: text, ', '),\n ''\n)`]: \"location_id\",\n [`COALESCE(\n STRING_AGG(location.${ModelLocationFields.location_name}:: text, ', '),\n ''\n)`]: \"location_name\",\n}\n\nexport const WorkerService = (props: WorkerServiceProps) => {\n\n const {\n ...rest\n } = props\n\n const workerModel = WorkerModel({ ...rest })\n\n const injectionFieldService = InjectionFieldService({ ...rest, injectionFieldType: \"user\" })\n\n // const userInjectionFieldModel = UserInjectionFieldModel({ ...rest })\n\n const createWorker = async ({ data }: WorkerCreateProps) => {\n\n const _data = getCreatePayload(data)\n\n if (!_data) {\n throw new Error(`Invalid create worker payload: ${JSON.stringify(_data)} `);\n }\n\n let response = await workerModel.create({ data: _data })\n\n return response\n }\n\n const updateWorker = async ({ userId, data }: WorkerUpdateProps) => {\n\n const _data = getUpdatePayload(data)\n\n if (!_data) {\n throw new Error(`Invalid update worker payload: ${JSON.stringify(_data)} `);\n }\n\n let response = await workerModel.update({ where: { [`${ModelWorkerFields.user_id} `]: userId }, data: _data })\n\n return response\n }\n\n const getWorker = async ({ id, datatypes = [], includePassword = false }: WorkerGetProps) => {\n\n let { data } = await listWorkers({\n includePassword,\n limit: 1,\n offset: 0,\n filters: [{ field: \"user_id\", operator: \"=\", value: id }],\n sortfield: \"user_id\",\n sortorder: \"ASC\",\n datatypes\n })\n\n return data[0] ?? null;\n\n };\n\n const listWorkers = async ({\n includePassword = false,\n limit,\n offset,\n filters,\n sortfield,\n sortorder,\n datatypes = []\n }: WorkerListProps) => {\n\n let data = []\n\n if (includePassword === true) {\n userSqlSelect = {\n ...userSqlSelect,\n [`usr.${ModelUserFields.login_password} `]: \"password\",\n }\n } else {\n delete userSqlSelect[`usr.${ModelUserFields.login_password} `];\n }\n\n let sqlSelect = [\n `COUNT(*) OVER() as filtered_count`,\n buildSqlSelect(``, mainSqlSelect),\n buildSqlSelect(``, userSqlSelect),\n buildSqlSelect(``, defaultSqlSelect),\n buildSqlSelect(``, userPropLocationSqlSelect),\n ]\n\n let sqlRelation = [\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"usr\", [\"wrk.user_id = usr.user_id\", \"usr.isdelete = false\", \"usr.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"creator\", [\"wrk.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"users\", \"updater\", [\"wrk.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"user_props\", \"usrprop_location\", [\"wrk.user_id = usrprop_location.user_id\", \"usrprop_location.type = 'LOCATION_ID'\", \"usrprop_location.isdelete = false\", \"usrprop_location.istrash = false\"]),\n buildSqlRelation(\"left\", \"wrk\", \"locations\", \"location\", [\"usrprop_location.props_id = location.location_id\", \"location.isdelete = false\", \"location.istrash = false\"]),\n ]\n\n let sqlGroupBy: string[] = [\n ...Object.keys(mainSqlSelect),\n ...Object.keys(userSqlSelect),\n // ...Object.keys(userPropLocationSqlSelect),\n ...Object.keys(defaultSqlSelect)\n ]\n\n let filterColumns = {\n ...mainSqlSelect,\n ...userSqlSelect,\n ...userPropLocationSqlSelect,\n ...defaultSqlSelect\n }\n\n if (datatypes.includes(workerDataTypes.workerInjectionFields)) {\n\n let activeInjectionFields = await injectionFieldService.listActiveInjectionFields(\"user\", \"worker\")\n\n const workerInjectionFieldSqlSelect = buildInjectionFieldsSqlSelect(\"uif\", activeInjectionFields)\n\n filterColumns = { ...filterColumns, ...workerInjectionFieldSqlSelect }\n\n sqlSelect = [...sqlSelect, ...(activeInjectionFields.length > 0 ? [buildSqlSelect(``, workerInjectionFieldSqlSelect)] : [])]\n sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"wrk\", \"user_injection_fields\", \"uif\", [\"wrk.user_id = uif.user_id\", \"uif.field_ref = 'user'\", \"uif.field_module = 'worker'\", \"uif.isdelete = false\", \"uif.istrash = false\"])]\n sqlGroupBy = [...sqlGroupBy, ...Object.keys(workerInjectionFieldSqlSelect)]\n\n }\n\n if (datatypes.includes(workerDataTypes.parentUser)) {\n\n filterColumns = { ...filterColumns, ...userParentSqlSelect }\n\n sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"wrk\", \"users\", \"parentuser\", [\"usr.parent_user_id = parentuser.user_id\", \"parentuser.isdelete = false\", \"parentuser.istrash = false\"])]\n sqlSelect = [...sqlSelect, buildSqlSelect(``, userParentSqlSelect)]\n sqlGroupBy = [...sqlGroupBy, ...Object.keys(userParentSqlSelect)]\n\n }\n\n if (datatypes.includes(workerDataTypes.location)) {\n\n let locationSqlSelect = {\n [`COALESCE(\n JSON_AGG(\n DISTINCT JSONB_BUILD_OBJECT(\n '${ModelLocationFields.location_id}', location.location_id,\n '${ModelLocationFields.location_code}', location.location_code,\n '${ModelLocationFields.location_name}', location.location_name,\n '${ModelLocationFields.location_type}', location.location_type,\n '${ModelLocationFields.address_1}', location.address_1,\n '${ModelLocationFields.address_2}', location.address_2,\n '${ModelLocationFields.area_id}', location.area_id,\n '${ModelLocationFields.country_id}', location.country_id,\n '${ModelLocationFields.state_id}', location.state_id,\n '${ModelLocationFields.postcode}', location.postcode,\n '${ModelLocationFields.is_default}', location.is_default,\n '${ModelLocationFields.person_contact}', location.person_contact,\n '${ModelLocationFields.person_name}', location.person_contact,\n '${ModelLocationFields.person_email}', location.person_email,\n '${ModelLocationFields.isdelete}', location.isdelete,\n '${ModelLocationFields.istrash}', location.istrash\n )\n ) FILTER(WHERE location.location_id IS NOT NULL AND location.isdelete = false AND location.istrash = false),\n '[]'\n )`]: \"locations\"\n }\n\n filterColumns = { ...filterColumns, ...locationSqlSelect }\n\n sqlSelect = [...sqlSelect, buildSqlSelect(``, locationSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"usrprop_location\", \"location\", \"brn\", [\"wrk.user_id = brn.user_id\", \"brn.isdelete = false\", \"brn.istrash = false\"])]\n\n }\n\n if (datatypes.includes(workerDataTypes.locationCount)) {\n\n let locationCountSqlSelect = {\n [`COUNT(DISTINCT location.${ModelLocationFields.location_id}):: INT`]: \"location_count\"\n }\n\n filterColumns = { ...filterColumns, ...locationCountSqlSelect }\n\n sqlSelect = [...sqlSelect, buildSqlSelect(``, locationCountSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"cus\", \"branches\", \"brncount\", [\"wrk.user_id = brncount.user_id\", \"brncount.isdelete = false\", \"brncount.istrash = false\"])]\n\n }\n\n // if (datatypes.includes(customerDataTypes.branchUserCount)) {\n\n // let branchUserCountSqlSelect = {\n // [`COUNT(DISTINCT brnusrcount.${ ModelBranchUserFields.branch_user_id }):: INT`]: \"branch_user_count\"\n // }\n\n // filterColumns = { ...filterColumns, ...branchUserCountSqlSelect }\n\n // sqlSelect = [...sqlSelect, buildSqlSelect(``, branchUserCountSqlSelect)]\n // sqlRelation = [...sqlRelation, buildSqlRelation(\"left\", \"cus\", \"branch_users\", \"brnusrcount\", [\"wrk.user_id = brnusrcount.user_id\", \"brnusrcount.isdelete = false\", \"brnusrcount.istrash = false\"])]\n\n // }\n\n let sqlWhere = [\n `wrk.isdelete = false`,\n `wrk.istrash = false`,\n ...(filters.length ? [buildSqlWhere(filters, filterColumns)?.where] : []),\n ]\n\n let sqlOrderby = buildSqlOrderBy(sortfield, sortorder)\n let sqlLimitOffset = buildSqlLimitOffset(limit, offset)\n\n const sqlRaw = buildSqlRawSelect({\n tableName: \"workers\",\n mainAlias: \"wrk\",\n accountId: rest.accountId,\n sqlSelect,\n sqlRelation,\n sqlWhere,\n sqlGroupBy,\n sqlOrderby,\n sqlLimitOffset\n })\n\n data = await workerModel.raw(sqlRaw)\n\n const response = {\n data: data.map(({ filtered_count, ...rest }) => rest),\n total: data.length ? Number(data[0].filtered_count) : 0\n }\n\n return response\n\n };\n\n const removeWorkers = async ({ userIds }: WorkerRemoveProps) => {\n\n if (!userIds.length) throwError('userIds is required');\n\n const response = await workerModel.remove({ where: { [`${ModelWorkerFields.user_id} `]: { in: userIds } } });\n\n return response\n };\n\n const getDataTypes = () => {\n return Object.values(workerDataTypes);\n }\n\n return {\n createWorker,\n updateWorker,\n getWorker,\n listWorkers,\n removeWorkers,\n getDataTypes\n }\n\n}\n\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DefaultServiceProps } from "./serviceUtils";
|
|
2
|
+
import { Request } from "express";
|
|
2
3
|
export type FeatureCallbackProps<T> = {
|
|
3
4
|
defaultServiceProps: DefaultServiceProps;
|
|
4
5
|
callbackParams: T;
|
|
6
|
+
req?: Request;
|
|
5
7
|
};
|
|
8
|
+
export declare const buildFeatureCallbackProps: <T>(props: FeatureCallbackProps<T>) => FeatureCallbackProps<T>;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildFeatureCallbackProps = void 0;
|
|
4
|
+
const buildFeatureCallbackProps = (props) => {
|
|
5
|
+
const { callbackParams, defaultServiceProps } = props;
|
|
6
|
+
const { req, ...rest } = defaultServiceProps;
|
|
7
|
+
return {
|
|
8
|
+
defaultServiceProps: rest,
|
|
9
|
+
callbackParams,
|
|
10
|
+
req,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.buildFeatureCallbackProps = buildFeatureCallbackProps;
|
|
3
14
|
//# sourceMappingURL=featureUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureUtils.js","sourceRoot":"","sources":["../../src/utils/featureUtils.ts"],"names":[],"mappings":"","sourcesContent":["import { DefaultServiceProps } from \"./serviceUtils\";\n\nexport type FeatureCallbackProps<T> = {\n defaultServiceProps: DefaultServiceProps,\n callbackParams: T\n}"]}
|
|
1
|
+
{"version":3,"file":"featureUtils.js","sourceRoot":"","sources":["../../src/utils/featureUtils.ts"],"names":[],"mappings":";;;AASO,MAAM,yBAAyB,GAAG,CACrC,KAA8B,EACP,EAAE;IAEzB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,mBAAmB,CAAA;IAE5C,OAAO;QACH,mBAAmB,EAAE,IAAI;QACzB,cAAc;QACd,GAAG;KACN,CAAC;AACN,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC","sourcesContent":["import { DefaultServiceProps } from \"./serviceUtils\";\nimport { Request } from \"express\";\n\nexport type FeatureCallbackProps<T> = {\n defaultServiceProps: DefaultServiceProps,\n callbackParams: T,\n req?: Request\n}\n\nexport const buildFeatureCallbackProps = <T>(\n props: FeatureCallbackProps<T>\n): FeatureCallbackProps<T> => {\n\n const { callbackParams, defaultServiceProps } = props\n const { req, ...rest } = defaultServiceProps\n\n return {\n defaultServiceProps: rest,\n callbackParams,\n req,\n };\n};"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { throwError, logError } from "./exceptionUtils";
|
|
|
9
9
|
export { getFormattedZodErrors, getFormattedZodErrorsIntoString, buildCommonStatusSchema, zodEnumFromObjectValues } from "./zodUtils";
|
|
10
10
|
export type { DefaultServiceProps } from "./serviceUtils";
|
|
11
11
|
export { getDefaultServiceProps, generateServiceProps } from "./serviceUtils";
|
|
12
|
+
export { buildFeatureCallbackProps } from "./featureUtils";
|
|
12
13
|
export type { FeatureCallbackProps } from "./featureUtils";
|
|
13
14
|
export { buildFullFieldName, groupPayloadInjectionFields } from "./injectionFieldUtils";
|
|
14
15
|
export { generateAuthToken, verifyAuthToken } from "./authUtils";
|
package/dist/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAllPermissionKeysByPolicies = exports.validateFormatMobileNumber = exports.validateFormatEmailAddress = exports.generateFileThumbnailBuffer = exports.verifyPassword = exports.hashPassword = exports.validateLoginPasswordFormat = exports.loginPasswordFormatSchema = exports.decryptAccessKeySecret = exports.encryptAccessKeySecret = exports.hashAccessKeySecret = exports.generateAccessKeySecret = exports.generateAccessKeyId = exports.verifyAuthToken = exports.generateAuthToken = exports.groupPayloadInjectionFields = exports.buildFullFieldName = exports.generateServiceProps = exports.getDefaultServiceProps = exports.zodEnumFromObjectValues = exports.buildCommonStatusSchema = exports.getFormattedZodErrorsIntoString = exports.getFormattedZodErrors = exports.logError = exports.throwError = exports.logger = exports.normalizePublicScopeFromBody = exports.createPublicScopeSchema = exports.validateModelFieldsWithData = exports.convertPayloadByTableSchema = exports.validateMultipleSchemas = exports.validateWithSchema = exports.formatDisplayDateTime = exports.getCurrentDateTimeISO = exports.getCurrentDateTime = exports.dayjs = exports.sendSuccess = exports.sendError = exports.HTTP_STATUS = exports.sharp = exports._ = exports.getCoreConfiguration = void 0;
|
|
6
|
+
exports.getAllPermissionKeysByPolicies = exports.validateFormatMobileNumber = exports.validateFormatEmailAddress = exports.generateFileThumbnailBuffer = exports.verifyPassword = exports.hashPassword = exports.validateLoginPasswordFormat = exports.loginPasswordFormatSchema = exports.decryptAccessKeySecret = exports.encryptAccessKeySecret = exports.hashAccessKeySecret = exports.generateAccessKeySecret = exports.generateAccessKeyId = exports.verifyAuthToken = exports.generateAuthToken = exports.groupPayloadInjectionFields = exports.buildFullFieldName = exports.buildFeatureCallbackProps = exports.generateServiceProps = exports.getDefaultServiceProps = exports.zodEnumFromObjectValues = exports.buildCommonStatusSchema = exports.getFormattedZodErrorsIntoString = exports.getFormattedZodErrors = exports.logError = exports.throwError = exports.logger = exports.normalizePublicScopeFromBody = exports.createPublicScopeSchema = exports.validateModelFieldsWithData = exports.convertPayloadByTableSchema = exports.validateMultipleSchemas = exports.validateWithSchema = exports.formatDisplayDateTime = exports.getCurrentDateTimeISO = exports.getCurrentDateTime = exports.dayjs = exports.sendSuccess = exports.sendError = exports.HTTP_STATUS = exports.sharp = exports._ = exports.getCoreConfiguration = void 0;
|
|
7
7
|
var coreConfigUtils_1 = require("./coreConfigUtils");
|
|
8
8
|
Object.defineProperty(exports, "getCoreConfiguration", { enumerable: true, get: function () { return coreConfigUtils_1.getCoreConfiguration; } });
|
|
9
9
|
var lodash_1 = require("lodash");
|
|
@@ -43,6 +43,8 @@ Object.defineProperty(exports, "zodEnumFromObjectValues", { enumerable: true, ge
|
|
|
43
43
|
var serviceUtils_1 = require("./serviceUtils");
|
|
44
44
|
Object.defineProperty(exports, "getDefaultServiceProps", { enumerable: true, get: function () { return serviceUtils_1.getDefaultServiceProps; } });
|
|
45
45
|
Object.defineProperty(exports, "generateServiceProps", { enumerable: true, get: function () { return serviceUtils_1.generateServiceProps; } });
|
|
46
|
+
var featureUtils_1 = require("./featureUtils");
|
|
47
|
+
Object.defineProperty(exports, "buildFeatureCallbackProps", { enumerable: true, get: function () { return featureUtils_1.buildFeatureCallbackProps; } });
|
|
46
48
|
var injectionFieldUtils_1 = require("./injectionFieldUtils");
|
|
47
49
|
Object.defineProperty(exports, "buildFullFieldName", { enumerable: true, get: function () { return injectionFieldUtils_1.buildFullFieldName; } });
|
|
48
50
|
Object.defineProperty(exports, "groupPayloadInjectionFields", { enumerable: true, get: function () { return injectionFieldUtils_1.groupPayloadInjectionFields; } });
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA;AAC7B,iCAAsC;AAA7B,4GAAA,OAAO,OAAK;AACrB,+BAAyC;AAAhC,+GAAA,OAAO,OAAS;AACzB,iDAAsE;AAA7D,4GAAA,WAAW,OAAA;AAAE,0GAAA,SAAS,OAAA;AAAE,4GAAA,WAAW,OAAA;AAC5C,yCAAsG;AAA7F,kGAAA,KAAK,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AAChF,6CAA6L;AAApL,iHAAA,kBAAkB,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,2HAAA,4BAA4B,OAAA;AACrK,uCAA+C;AAAtC,mHAAA,OAAO,OAAU;AAC1B,mDAAwD;AAA/C,4GAAA,UAAU,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAC7B,2CAA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AAjD,yHAAA,yBAAyB,OAAA;AAElC,6DAAuF;AAA9E,yHAAA,kBAAkB,OAAA;AAAE,kIAAA,2BAA2B,OAAA;AACxD,yCAAgE;AAAvD,8GAAA,iBAAiB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAC3C,mDAAoJ;AAA3I,qHAAA,mBAAmB,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAAE,wHAAA,sBAAsB,OAAA;AAAE,wHAAA,sBAAsB,OAAA;AAC1H,iDAAsH;AAA7G,0HAAA,yBAAyB,OAAA;AAAE,4HAAA,2BAA2B,OAAA;AAAE,6GAAA,YAAY,OAAA;AAAE,+GAAA,cAAc,OAAA;AAC7F,iDAA6D;AAApD,4HAAA,2BAA2B,OAAA;AACpC,6DAA8F;AAArF,iIAAA,0BAA0B,OAAA;AAAE,iIAAA,0BAA0B,OAAA;AAC/D,2DAAqE;AAA5D,oIAAA,8BAA8B,OAAA","sourcesContent":["export { getCoreConfiguration } from \"./coreConfigUtils\";\nexport { default as _ } from \"lodash\";\nexport { default as sharp } from \"sharp\";\nexport { HTTP_STATUS, sendError, sendSuccess } from \"./responseUtils\";\nexport { dayjs, getCurrentDateTime, getCurrentDateTimeISO, formatDisplayDateTime } from \"./dateUtils\";\nexport { validateWithSchema, validateMultipleSchemas, convertPayloadByTableSchema, validateModelFieldsWithData, createPublicScopeSchema, normalizePublicScopeFromBody } from \"./schemaUtils\";\nexport { default as logger } from \"./logUtils\";\nexport { throwError, logError } from \"./exceptionUtils\";\n// export { getSwmAuth } from \"./smwUtils\";\n// export { getRequestHeaderLocCode, checkRequestContentIsEmpty } from \"./requestUtils\";\n// export { storeJwtInMemory, getJwtFromMemory } from \"./jwtUtils\";\n// export { resizeImageBuffer } from \"./shapeUtils\"\nexport { getFormattedZodErrors, getFormattedZodErrorsIntoString, buildCommonStatusSchema, zodEnumFromObjectValues } from \"./zodUtils\"\nexport type { DefaultServiceProps } from \"./serviceUtils\"\nexport { getDefaultServiceProps, generateServiceProps } from \"./serviceUtils\"\nexport { buildFeatureCallbackProps } from \"./featureUtils\"\nexport type { FeatureCallbackProps } from \"./featureUtils\"\nexport { buildFullFieldName, groupPayloadInjectionFields } from \"./injectionFieldUtils\"\nexport { generateAuthToken, verifyAuthToken } from \"./authUtils\"\nexport { generateAccessKeyId, generateAccessKeySecret, hashAccessKeySecret, encryptAccessKeySecret, decryptAccessKeySecret } from \"./accessKeyUtils\"\nexport { loginPasswordFormatSchema, validateLoginPasswordFormat, hashPassword, verifyPassword } from \"./passwordUtils\"\nexport { generateFileThumbnailBuffer } from \"./fileThumbnail\"\nexport { validateFormatEmailAddress, validateFormatMobileNumber } from \"./validateFormatUtils\"\nexport { getAllPermissionKeysByPolicies } from \"./accessControlUtils\""]}
|
|
@@ -7,6 +7,7 @@ export type DefaultServiceProps = {
|
|
|
7
7
|
isOperator: boolean;
|
|
8
8
|
accessKey?: string;
|
|
9
9
|
accessKeyId?: string;
|
|
10
|
+
req?: Request;
|
|
10
11
|
};
|
|
11
12
|
export declare const getDefaultServiceProps: (req: Request) => DefaultServiceProps;
|
|
12
13
|
export declare const generateServiceProps: ({ buildType, accessKey }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceUtils.js","sourceRoot":"","sources":["../../src/utils/serviceUtils.ts"],"names":[],"mappings":";;;AAEA,yCAA6D;AAC7D,qDAA8C;AAE9C,uDAAyD;
|
|
1
|
+
{"version":3,"file":"serviceUtils.js","sourceRoot":"","sources":["../../src/utils/serviceUtils.ts"],"names":[],"mappings":";;;AAEA,yCAA6D;AAC7D,qDAA8C;AAE9C,uDAAyD;AAalD,MAAM,sBAAsB,GAAG,CAAC,GAAY,EAAuB,EAAE;IAExE,MAAM,kBAAkB,GAAI,GAAW,EAAE,IAAI,IAAI,EAAE,CAAA;IACnD,MAAM,SAAS,GAAI,GAAW,EAAE,SAAS,IAAI,EAAE,CAAA;IAC/C,MAAM,YAAY,GAAI,GAA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AE,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAAC;QAChD,YAAY,EAAE,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC;QACjD,cAAc,EAAE,kBAAkB,EAAE,SAAS,IAAI,EAAE;QACnD,SAAS,EAAE,EAAE;QACb,SAAS;QACT,WAAW,EAAE,kBAAkB,EAAE,aAAa,IAAI,EAAE;QACpD,UAAU,EAAE,kBAAkB,EAAE,SAAS,KAAK,oBAAS,CAAC,QAAQ;KACnE,CAAA;AAEL,CAAC,CAAA;AAnDY,QAAA,oBAAoB,wBAmDhC","sourcesContent":["import { Request } from \"express\";\n\nimport { AccessKeyUtilService, userTypes } from \"@/services\";\nimport { throwError } from \"./exceptionUtils\";\n\nimport { getCoreConfiguration } from \"./coreConfigUtils\";\n\nexport type DefaultServiceProps = {\n accountId: number,\n actionUserId: number,\n actionUserType: string,\n authToken: string,\n isOperator: boolean,\n accessKey?: string,\n accessKeyId?: string\n req?: Request\n}\n\nexport const getDefaultServiceProps = (req: Request): DefaultServiceProps => {\n\n const requestAuthContext = (req as any)?.auth ?? {}\n const accountId = (req as any)?.accountId ?? \"\"\n const actionUserId = (req as any)?.actionUserId ?? \"\"\n const actionUserType = (req as any)?.actionUserType ?? \"\"\n\n const {\n authToken = '',\n isOperator = false,\n accessKey = '',\n accessKeyId = ''\n } = requestAuthContext\n\n return {\n accountId,\n actionUserId,\n actionUserType,\n authToken,\n isOperator,\n accessKey,\n accessKeyId,\n req\n }\n}\n\nexport const generateServiceProps = async ({\n buildType = \"access_key\",\n accessKey\n}: {\n buildType?: \"access_key\",\n accessKey: string,\n}): Promise<DefaultServiceProps> => {\n\n const { prisma } = getCoreConfiguration()\n\n if (!buildType) {\n throwError(`Build Type is required in generate service props from access key`)\n }\n\n if (!prisma) {\n throwError(`Prisma is required in generate service props from access key`)\n }\n\n if (!accessKey) {\n throwError(`Access Key is required in generate service props from access key`)\n }\n\n const accessKeyUtilService = AccessKeyUtilService({\n accountId: 0,\n actionUserId: 0,\n actionUserType: \"\",\n authToken: '',\n isOperator: true,\n accessKey: '',\n accessKeyId: '',\n accessKeyUserType: \"operator\"\n })\n\n const validatedAccessKey = await accessKeyUtilService.validateAccessKey({\n data: {\n accessKey\n }\n })\n\n // console.log('defaultServiceProps', defaultServiceProps, validatedAccessKey)\n\n return {\n accountId: Number(validatedAccessKey?.accountid),\n actionUserId: Number(validatedAccessKey?.user_id),\n actionUserType: validatedAccessKey?.user_type ?? \"\",\n authToken: \"\",\n accessKey,\n accessKeyId: validatedAccessKey?.access_key_id ?? \"\",\n isOperator: validatedAccessKey?.user_type === userTypes.operator,\n }\n\n}"]}
|