@vritti/api-sdk 0.2.4 → 0.2.6

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/xlsx.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ type ExportFormat = 'xlsx' | 'xls' | 'csv' | 'tsv' | 'ods';
2
+ declare function buildExportBuffer(rows: Record<string, unknown>[], format?: ExportFormat): Buffer;
3
+ declare function getExportMimeType(format: ExportFormat): string;
4
+ declare function getExportExt(format: ExportFormat): string;
5
+
6
+ export { type ExportFormat, buildExportBuffer, getExportExt, getExportMimeType };
package/dist/xlsx.js ADDED
@@ -0,0 +1,61 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/utils/export.utils.ts
5
+ import { utils, write } from "xlsx";
6
+ var FORMAT_CONFIG = {
7
+ xlsx: {
8
+ bookType: "xlsx",
9
+ mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
10
+ ext: "xlsx"
11
+ },
12
+ xls: {
13
+ bookType: "biff8",
14
+ mimeType: "application/vnd.ms-excel",
15
+ ext: "xls"
16
+ },
17
+ csv: {
18
+ bookType: "csv",
19
+ mimeType: "text/csv",
20
+ ext: "csv"
21
+ },
22
+ tsv: {
23
+ bookType: "csv",
24
+ mimeType: "text/tab-separated-values",
25
+ ext: "tsv",
26
+ opts: {
27
+ FS: " "
28
+ }
29
+ },
30
+ ods: {
31
+ bookType: "ods",
32
+ mimeType: "application/vnd.oasis.opendocument.spreadsheet",
33
+ ext: "ods"
34
+ }
35
+ };
36
+ function buildExportBuffer(rows, format = "xlsx") {
37
+ const config = FORMAT_CONFIG[format];
38
+ const ws = utils.json_to_sheet(rows);
39
+ const wb = utils.book_new();
40
+ utils.book_append_sheet(wb, ws, "Sheet1");
41
+ return write(wb, {
42
+ type: "buffer",
43
+ bookType: config.bookType,
44
+ ...config.opts
45
+ });
46
+ }
47
+ __name(buildExportBuffer, "buildExportBuffer");
48
+ function getExportMimeType(format) {
49
+ return FORMAT_CONFIG[format].mimeType;
50
+ }
51
+ __name(getExportMimeType, "getExportMimeType");
52
+ function getExportExt(format) {
53
+ return FORMAT_CONFIG[format].ext;
54
+ }
55
+ __name(getExportExt, "getExportExt");
56
+ export {
57
+ buildExportBuffer,
58
+ getExportExt,
59
+ getExportMimeType
60
+ };
61
+ //# sourceMappingURL=xlsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/export.utils.ts"],"sourcesContent":["import { type BookType, utils, write } from 'xlsx';\n\nexport type ExportFormat = 'xlsx' | 'xls' | 'csv' | 'tsv' | 'ods';\n\nconst FORMAT_CONFIG: Record<\n ExportFormat,\n { bookType: BookType; mimeType: string; ext: string; opts?: Record<string, unknown> }\n> = {\n xlsx: {\n bookType: 'xlsx',\n mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n ext: 'xlsx',\n },\n xls: { bookType: 'biff8', mimeType: 'application/vnd.ms-excel', ext: 'xls' },\n csv: { bookType: 'csv', mimeType: 'text/csv', ext: 'csv' },\n tsv: { bookType: 'csv', mimeType: 'text/tab-separated-values', ext: 'tsv', opts: { FS: '\\t' } },\n ods: { bookType: 'ods', mimeType: 'application/vnd.oasis.opendocument.spreadsheet', ext: 'ods' },\n};\n\n// Converts an array of row objects into a spreadsheet buffer in the given format\nexport function buildExportBuffer(rows: Record<string, unknown>[], format: ExportFormat = 'xlsx'): Buffer {\n const config = FORMAT_CONFIG[format];\n const ws = utils.json_to_sheet(rows);\n const wb = utils.book_new();\n utils.book_append_sheet(wb, ws, 'Sheet1');\n return write(wb, { type: 'buffer', bookType: config.bookType, ...config.opts }) as Buffer;\n}\n\nexport function getExportMimeType(format: ExportFormat): string {\n return FORMAT_CONFIG[format].mimeType;\n}\n\nexport function getExportExt(format: ExportFormat): string {\n return FORMAT_CONFIG[format].ext;\n}\n"],"mappings":";;;;AAAA,SAAwBA,OAAOC,aAAa;AAI5C,IAAMC,gBAGF;EACFC,MAAM;IACJC,UAAU;IACVC,UAAU;IACVC,KAAK;EACP;EACAC,KAAK;IAAEH,UAAU;IAASC,UAAU;IAA4BC,KAAK;EAAM;EAC3EE,KAAK;IAAEJ,UAAU;IAAOC,UAAU;IAAYC,KAAK;EAAM;EACzDG,KAAK;IAAEL,UAAU;IAAOC,UAAU;IAA6BC,KAAK;IAAOI,MAAM;MAAEC,IAAI;IAAK;EAAE;EAC9FC,KAAK;IAAER,UAAU;IAAOC,UAAU;IAAkDC,KAAK;EAAM;AACjG;AAGO,SAASO,kBAAkBC,MAAiCC,SAAuB,QAAM;AAC9F,QAAMC,SAASd,cAAca,MAAAA;AAC7B,QAAME,KAAKC,MAAMC,cAAcL,IAAAA;AAC/B,QAAMM,KAAKF,MAAMG,SAAQ;AACzBH,QAAMI,kBAAkBF,IAAIH,IAAI,QAAA;AAChC,SAAOM,MAAMH,IAAI;IAAEI,MAAM;IAAUpB,UAAUY,OAAOZ;IAAU,GAAGY,OAAON;EAAK,CAAA;AAC/E;AANgBG;AAQT,SAASY,kBAAkBV,QAAoB;AACpD,SAAOb,cAAca,MAAAA,EAAQV;AAC/B;AAFgBoB;AAIT,SAASC,aAAaX,QAAoB;AAC/C,SAAOb,cAAca,MAAAA,EAAQT;AAC/B;AAFgBoB;","names":["utils","write","FORMAT_CONFIG","xlsx","bookType","mimeType","ext","xls","csv","tsv","opts","FS","ods","buildExportBuffer","rows","format","config","ws","utils","json_to_sheet","wb","book_new","book_append_sheet","write","type","getExportMimeType","getExportExt"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vritti/api-sdk",
3
3
  "type": "module",
4
- "version": "0.2.4",
4
+ "version": "0.2.6",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -16,6 +16,16 @@
16
16
  "default": "./dist/index.cjs"
17
17
  }
18
18
  },
19
+ "./decimal": {
20
+ "import": {
21
+ "types": "./dist/decimal.d.ts",
22
+ "default": "./dist/decimal.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/decimal.d.cts",
26
+ "default": "./dist/decimal.cjs"
27
+ }
28
+ },
19
29
  "./drizzle-orm": {
20
30
  "import": {
21
31
  "types": "./dist/drizzle-orm.d.ts",
@@ -35,6 +45,36 @@
35
45
  "types": "./dist/drizzle-pg-core.d.cts",
36
46
  "default": "./dist/drizzle-pg-core.cjs"
37
47
  }
48
+ },
49
+ "./xlsx": {
50
+ "import": {
51
+ "types": "./dist/xlsx.d.ts",
52
+ "default": "./dist/xlsx.js"
53
+ },
54
+ "require": {
55
+ "types": "./dist/xlsx.d.cts",
56
+ "default": "./dist/xlsx.cjs"
57
+ }
58
+ },
59
+ "./lodash": {
60
+ "import": {
61
+ "types": "./dist/lodash.d.ts",
62
+ "default": "./dist/lodash.js"
63
+ },
64
+ "require": {
65
+ "types": "./dist/lodash.d.cts",
66
+ "default": "./dist/lodash.cjs"
67
+ }
68
+ },
69
+ "./money": {
70
+ "import": {
71
+ "types": "./dist/money.d.ts",
72
+ "default": "./dist/money.js"
73
+ },
74
+ "require": {
75
+ "types": "./dist/money.d.cts",
76
+ "default": "./dist/money.cjs"
77
+ }
38
78
  }
39
79
  },
40
80
  "files": [
@@ -52,17 +92,23 @@
52
92
  },
53
93
  "dependencies": {
54
94
  "@getbrevo/brevo": "^4.0.1",
55
- "drizzle-orm": "^1.0.0-beta.3-36e9b9e",
95
+ "decimal.js": "^10.6.0",
96
+ "dinero.js": "2.0.2",
97
+ "drizzle-orm": "1.0.0-rc.3",
56
98
  "ioredis": "^5.4.1",
99
+ "lodash": "^4.18.1",
100
+ "nats": "^2.29.3",
57
101
  "pg": "^8.16.0",
58
102
  "winston": "^3.11.0",
59
- "winston-daily-rotate-file": "^5.0.0"
103
+ "winston-daily-rotate-file": "^5.0.0",
104
+ "xlsx": "^0.18.5"
60
105
  },
61
106
  "peerDependencies": {
62
107
  "@nestjs/common": "^11.0.0",
63
108
  "@nestjs/config": "^3.0.0",
64
109
  "@nestjs/core": "^11.0.0",
65
110
  "@nestjs/jwt": "^11.0.0",
111
+ "@nestjs/microservices": "^11.0.0",
66
112
  "@nestjs/swagger": "^8.0.0",
67
113
  "class-transformer": "^0.5.0",
68
114
  "class-validator": "^0.14.0",
@@ -79,17 +125,23 @@
79
125
  },
80
126
  "class-validator": {
81
127
  "optional": true
128
+ },
129
+ "@nestjs/microservices": {
130
+ "optional": true
82
131
  }
83
132
  },
84
133
  "devDependencies": {
85
134
  "@biomejs/biome": "2.4.2",
135
+ "@fastify/multipart": "^9.4.0",
86
136
  "@nestjs/common": "11.1.13",
87
137
  "@nestjs/config": "^3.2.3",
88
138
  "@nestjs/core": "11.1.13",
89
139
  "@nestjs/jwt": "^11.0.1",
140
+ "@nestjs/microservices": "11.1.13",
90
141
  "@nestjs/swagger": "^8.0.0",
91
142
  "@swc/core": "^1.13.5",
92
143
  "@types/jsonwebtoken": "^9.0.8",
144
+ "@types/lodash": "^4.17.24",
93
145
  "@types/node": "^24.9.2",
94
146
  "@types/pg": "^8.16.0",
95
147
  "class-transformer": "^0.5.0",