@comasoft/nestjs 0.1.42 → 0.1.43
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/README.md +2 -0
- package/dist/database/entities/logs-audit.entity.js +1 -1
- package/dist/enums.common.d.ts +2 -1
- package/dist/enums.common.js +1 -1
- package/dist/notifications/services/slack.service.d.ts +6 -1
- package/dist/notifications/services/slack.service.js +1 -1
- package/dist/utils/pagination-qb.utils.js +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__decorate||function(e,t,o,n){var r
|
|
1
|
+
var e=this&&this.__decorate||function(e,t,o,n){var i,r=arguments.length,d=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(d=(r<3?i(d):r>3?i(t,o,d):i(t,o))||d);return r>3&&d&&Object.defineProperty(t,o,d),d},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.LogsAudit=void 0;const o=require("typeorm"),n=require("../../enums.common");let i=class LogsAudit{};exports.LogsAudit=i,e([(0,o.PrimaryGeneratedColumn)(),t("design:type",Number)],i.prototype,"id",void 0),e([(0,o.Column)("char",{length:21}),t("design:type",String)],i.prototype,"uid",void 0),e([(0,o.Column)("varchar",{length:255}),t("design:type",String)],i.prototype,"name",void 0),e([(0,o.Column)("varchar",{length:50,nullable:!0}),t("design:type",String)],i.prototype,"entity",void 0),e([(0,o.Column)("int",{nullable:!0,comment:"-1: all, 0: none"}),t("design:type",Number)],i.prototype,"entity_id",void 0),e([(0,o.Column)("enum",{enum:n.AUDIT_ACTION,nullable:!0}),t("design:type",String)],i.prototype,"action",void 0),e([(0,o.Column)("int"),t("design:type",Number)],i.prototype,"user_id",void 0),e([(0,o.Column)("jsonb",{nullable:!0}),t("design:type",Object)],i.prototype,"changes",void 0),e([(0,o.Column)("varchar",{length:45,nullable:!0}),t("design:type",String)],i.prototype,"ip_address",void 0),e([(0,o.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],i.prototype,"user_agent",void 0),e([(0,o.Column)("varchar",{length:255,nullable:!0}),t("design:type",String)],i.prototype,"description",void 0),e([(0,o.Column)("timestamptz"),t("design:type",Date)],i.prototype,"occurred_at",void 0),e([(0,o.CreateDateColumn)({type:"timestamptz"}),t("design:type",Date)],i.prototype,"created_at",void 0),exports.LogsAudit=i=e([(0,o.Entity)("logs_audit"),(0,o.Index)(["uid"]),(0,o.Index)(["name","entity_id"]),(0,o.Index)(["user_id","name","entity_id"])],i);
|
package/dist/enums.common.d.ts
CHANGED
package/dist/enums.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t,
|
|
1
|
+
var e,o,t,n,E,p,i;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LIKE_TYPE=exports.NOTIFICATION_STATUS=exports.FILE_STATUS=exports.AUDIT_ACTION=exports.DEVICE_TYPE=exports.MIME_TYPE=exports.FILE_TYPE=void 0,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.AUDIO="AUDIO",e.OTHER="OTHER"}(e||(exports.FILE_TYPE=e={})),function(e){e.JPEG="image/jpeg",e.PNG="image/png",e.GIF="image/gif",e.PDF="application/pdf",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.TXT="text/plain",e.HTML="text/html",e.CSV="text/csv"}(o||(exports.MIME_TYPE=o={})),function(e){e.ANDROID="android",e.IOS="ios",e.PC="pc",e.MAC="mac",e.OTHER="other"}(t||(exports.DEVICE_TYPE=t={})),function(e){e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.DOWNLOAD="download"}(n||(exports.AUDIT_ACTION=n={})),function(e){e.PENDING="pending",e.COMPLETED="completed",e.FAILED="failed",e.DELETED="deleted"}(E||(exports.FILE_STATUS=E={})),function(e){e.PENDING="pending",e.SENT="sent",e.READ="read",e.FAILED="failed"}(p||(exports.NOTIFICATION_STATUS=p={})),function(e){e.LIKE="like",e.DISLIKE="dislike",e.NONE="none"}(i||(exports.LIKE_TYPE=i={}));
|
|
@@ -2,5 +2,10 @@ import { ConfigService } from '@nestjs/config';
|
|
|
2
2
|
export declare class SlackService {
|
|
3
3
|
private readonly configService;
|
|
4
4
|
constructor(configService: ConfigService);
|
|
5
|
-
send(channel: string, message: string): Promise<
|
|
5
|
+
send(channel: string, message: string): Promise<{
|
|
6
|
+
channel: string;
|
|
7
|
+
success: boolean;
|
|
8
|
+
messageId: string;
|
|
9
|
+
status: string;
|
|
10
|
+
}>;
|
|
6
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=this&&this.__decorate||function(e,t,n,c){var r
|
|
1
|
+
var e=this&&this.__decorate||function(e,t,n,c){var o,r=arguments.length,i=r<3?t:null===c?c=Object.getOwnPropertyDescriptor(t,n):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,c);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},n=this&&this.__awaiter||function(e,t,n,c){return new(n||(n=Promise))(function(o,r){function fulfilled(e){try{step(c.next(e))}catch(e){r(e)}}function rejected(e){try{step(c.throw(e))}catch(e){r(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((c=c.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SlackService=void 0;const c=require("@nestjs/common"),o=require("@nestjs/config");let r=class SlackService{constructor(e){this.configService=e}send(e,t){return n(this,void 0,void 0,function*(){if(!this.configService.get("SLACK_CHANNEL")||!this.configService.get("SLACK_WEBHOOK_URL"))throw new Error("SLACK_CHANNEL or SLACK_WEBHOOK_URL is not set");return console.log("📢 [SLACK] 발송:",{channel:e,message:t,webhook_url:this.configService.get("SLACK_WEBHOOK_URL"),default_channel:this.configService.get("SLACK_CHANNEL"),timestamp:(new Date).toISOString()}),{channel:e,success:!0,messageId:`slack-${Date.now()}`,status:"sent"}})}};exports.SlackService=r,exports.SlackService=r=e([(0,c.Injectable)(),t("design:paramtypes",[o.ConfigService])],r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function validateAndParseDate(e){if(!/^\d{8}T\d{6}Z$/.test(e))throw new Error("Invalid date format. Use YYYYMMDDTHHMMSSZ (e.g., 20250122T150000Z)");const n=e.substring(0,4),t=e.substring(4,6),r=e.substring(6,8),a=e.substring(9,11),i=e.substring(11,13),s=e.substring(13,15),l=new Date(`${n}-${t}-${r}T${a}:${i}:${s}Z`);if(isNaN(l.getTime()))throw new Error("Invalid date");return l}Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyFiltersAndSorting=function applyFiltersAndSorting(n,t){const{_keyword:r,_group:a,_sort:i,aliasName:s="a",keywordFields:l=["name"],groupFields:o=[]}=t;return function applyKeywordFilter(e,n,t,r){if(n){const a=r.map(e=>`${t}.${e} LIKE :keyword`);e.andWhere(`(${a.join(" OR ")})`,{keyword
|
|
1
|
+
function validateAndParseDate(e){if(!/^\d{8}T\d{6}Z$/.test(e))throw new Error("Invalid date format. Use YYYYMMDDTHHMMSSZ (e.g., 20250122T150000Z)");const n=e.substring(0,4),t=e.substring(4,6),r=e.substring(6,8),a=e.substring(9,11),i=e.substring(11,13),s=e.substring(13,15),l=new Date(`${n}-${t}-${r}T${a}:${i}:${s}Z`);if(isNaN(l.getTime()))throw new Error("Invalid date");return l}Object.defineProperty(exports,"__esModule",{value:!0}),exports.applyFiltersAndSorting=function applyFiltersAndSorting(n,t){const{_keyword:r,_group:a,_sort:i,aliasName:s="a",keywordFields:l=["name"],groupFields:o=[]}=t;return function applyKeywordFilter(e,n,t,r){if(n){const a=r.map(e=>`${t}.${e} LIKE :keyword`);e.andWhere(`(${a.join(" OR ")})`,{keyword:`${n}`})}}(n,r,s,l),function applyGroupFilter(n,t,r,a){if(!t)return;if(0===a.length)return;const i=t.split("|");if(i.some(e=>{const[n]=e.split("-");return!a.includes(n)}))throw new Error("Invalid field detected in group filter");const s=[],l={};i.forEach((n,t)=>{const[a,i]=n.split(/-(.+)/),o=a.includes(".")?a:`${r}.${a}`;let $;$=i.includes("__")?a.includes("_at")||a.includes("_date")?e.handleDateRange(o,i,t):e.handleNumberRange(o,i,t):e.handleEquals(o,i,t),$.condition&&(s.push($.condition),Object.assign(l,$.parameters))}),s.length>0&&n.andWhere(`(${s.join(" AND ")})`,l)}(n,a,s,o),function applySorting(e,n,t){if(n){n.split("|").forEach((n,r)=>{const[a,i]=n.split("-"),s=i.toUpperCase();if("ASC"!==s&&"DESC"!==s)throw new Error(`Invalid sort order: ${i}`);0===r?e.orderBy(`${t}.${a}`,s):e.addOrderBy(`${t}.${a}`,s)})}else{Object.keys(e.expressionMap.orderBys).length>0||e.orderBy(`${t}.id`,"DESC")}}(n,i,s),n};const e={handleEquals:(e,n,t)=>({condition:`${e} = :${e}${t}`,parameters:{[`${e}${t}`]:n}}),handleNumberRange(e,n,t){const[r,a]=n.split("__").map(e=>""===e?null:Number(e)),i=[],s={};return null!==r&&null!==a?(i.push(`${e} BETWEEN :${e}Min${t} AND :${e}Max${t}`),s[`${e}Min${t}`]=r,s[`${e}Max${t}`]=a):null!==r?(i.push(`${e} >= :${e}Min${t}`),s[`${e}Min${t}`]=r):null!==a&&(i.push(`${e} <= :${e}Max${t}`),s[`${e}Max${t}`]=a),{condition:i.join(" AND "),parameters:s}},handleDateRange(e,n,t){const[r,a]=n.split("__").map(e=>""===e?null:e),i=[],s={};return null!==r&&null!==a?(i.push(`${e} BETWEEN :${e}Min${t} AND :${e}Max${t}`),s[`${e}Min${t}`]=validateAndParseDate(r),s[`${e}Max${t}`]=validateAndParseDate(a)):null!==r?(i.push(`${e} >= :${e}Min${t}`),s[`${e}Min${t}`]=validateAndParseDate(r)):null!==a&&(i.push(`${e} <= :${e}Max${t}`),s[`${e}Max${t}`]=validateAndParseDate(a)),{condition:i.join(" AND "),parameters:s}}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comasoft/nestjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"description": "",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc -p tsconfig.build.json",
|
|
25
|
-
"uglify": "find dist -name '*.js' -exec terser {} --compress --mangle --keep-fnames --module -o {};",
|
|
26
25
|
"lint": "eslint 'lib/**/*.ts' --fix,",
|
|
27
26
|
"prepublish:npm": "npm run build",
|
|
28
27
|
"publish:npm": "npm publish --access public",
|