@keshavsoft/tallyextract 1.1.2

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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -0
  3. package/index.d.ts +7 -0
  4. package/index.js +1 -0
  5. package/package.json +30 -0
  6. package/src/core/configStore.js +10 -0
  7. package/src/helpers/getLatestVersion.js +15 -0
  8. package/src/scripts/generateSamples.js +57 -0
  9. package/src/scripts/samples/aggregate_count.js +5 -0
  10. package/src/scripts/samples/mutate_deleteWithChecks.js +5 -0
  11. package/src/scripts/samples/mutate_insertAsIs.js +5 -0
  12. package/src/scripts/samples/mutate_insertFlat.js +5 -0
  13. package/src/scripts/samples/mutate_insertGenPk.js +5 -0
  14. package/src/scripts/samples/mutate_insertWithChecks.js +5 -0
  15. package/src/scripts/samples/mutate_updateWithChecks.js +5 -0
  16. package/src/scripts/samples/query_filterByColumns.js +5 -0
  17. package/src/scripts/samples/query_filterByPk.js +5 -0
  18. package/src/scripts/samples/query_findAll.js +5 -0
  19. package/src/scripts/samples/query_findByPk.js +5 -0
  20. package/src/scripts/updateIndex.js +16 -0
  21. package/src/utils/pathBuilder.js +3 -0
  22. package/src/v1/Import/Templates/inventory.json +121 -0
  23. package/src/v1/Import/Templates/ledgers.json +28 -0
  24. package/src/v1/Import/Templates/main.json +224 -0
  25. package/src/v1/Import/Templates/template.json +224 -0
  26. package/src/v1/Import/ledgers.json +8 -0
  27. package/src/v1/Import/staticVariables.json +12 -0
  28. package/src/v1/api/index.js +3 -0
  29. package/src/v1/api/ledger.js +6 -0
  30. package/src/v1/api/stockItems.js +6 -0
  31. package/src/v1/cli.js +11 -0
  32. package/src/v1/config/getSchema.js +20 -0
  33. package/src/v1/core/sendToTally.js +21 -0
  34. package/src/v1/engine/index.js +5 -0
  35. package/src/v1/engine/mutate/delete/deleteBase.js +26 -0
  36. package/src/v1/engine/mutate/delete/deleteWithChecks.js +14 -0
  37. package/src/v1/engine/mutate/index.js +7 -0
  38. package/src/v1/engine/mutate/insert/insertAsIs.js +7 -0
  39. package/src/v1/engine/mutate/insert/insertBase.js +19 -0
  40. package/src/v1/engine/mutate/insert/insertFlat.js +24 -0
  41. package/src/v1/engine/mutate/insert/insertGenPk copy.js +39 -0
  42. package/src/v1/engine/mutate/insert/insertGenPk.js +41 -0
  43. package/src/v1/engine/mutate/insert/insertWithChecks.js +52 -0
  44. package/src/v1/engine/mutate/update/updateBase.js +26 -0
  45. package/src/v1/engine/mutate/update/updateWithChecks.js +18 -0
  46. package/src/v1/engine/query/aggregate/count.js +13 -0
  47. package/src/v1/engine/query/aggregate/index.js +1 -0
  48. package/src/v1/engine/query/filterByColumns.js +18 -0
  49. package/src/v1/engine/query/filterByPk.js +18 -0
  50. package/src/v1/engine/query/findAll.js +14 -0
  51. package/src/v1/engine/query/findByPk.js +18 -0
  52. package/src/v1/engine/query/index.js +8 -0
  53. package/src/v1/helpers/buildMutate.js +28 -0
  54. package/src/v1/helpers/buildQuery.js +27 -0
  55. package/src/v1/helpers/file/read.js +7 -0
  56. package/src/v1/helpers/file/write.js +5 -0
  57. package/src/v1/helpers/pkHelper.js +19 -0
  58. package/src/v1/helpers/validate.js +27 -0
  59. package/src/v1/helpers/validateHelper.js +27 -0
  60. package/src/v1/helpers/validators/default.js +5 -0
  61. package/src/v1/helpers/validators/enum.js +7 -0
  62. package/src/v1/helpers/validators/length.js +11 -0
  63. package/src/v1/helpers/validators/minMax.js +11 -0
  64. package/src/v1/helpers/validators/pattern.js +8 -0
  65. package/src/v1/helpers/validators/required.js +5 -0
  66. package/src/v1/helpers/validators/type.js +15 -0
  67. package/src/v1/helpers/validators/unique.js +8 -0
  68. package/src/v1/index.js +1 -0
  69. package/src/v1/schema/schema.json +133 -0
  70. package/src/v1/utils/readJson.js +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KeshavSoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to do so, subject to the
10
+ following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # KeshavSoft
2
+
3
+ Simple tools. Clean architecture. Fast development.
4
+
5
+ ---
6
+
7
+ ## @keshavsoft/kschema
8
+
9
+ A lightweight schema-driven JSON database for Node.js.
10
+
11
+ ---
12
+
13
+ ## Install
14
+
15
+ npm i @keshavsoft/kschema
16
+
17
+ ---
18
+
19
+ ## Usage
20
+
21
+ import { kschema } from "@keshavsoft/kschema";
22
+
23
+ kschema.loadConfig({ dataPath: "./data" });
24
+
25
+ const users = kschema.table("users");
26
+
27
+ users.insert({ name: "keshav" });
28
+
29
+ const data = users.get();
30
+
31
+ console.log(data);
32
+
33
+ ---
34
+
35
+ ## API
36
+
37
+ Create
38
+
39
+ users.insert(record);
40
+ users.insertStrict(record);
41
+
42
+ Read
43
+
44
+ users.get();
45
+ users.findByPk(id);
46
+
47
+ Filter
48
+
49
+ users.filterByPk(id);
50
+ users.filterByColumns({ name: "keshav" });
51
+
52
+ Update
53
+
54
+ users.update(record);
55
+
56
+ Delete
57
+
58
+ users.delete(id);
59
+ users.deleteByColumns({ name: "keshav" });
60
+
61
+ ---
62
+
63
+ ## Features
64
+
65
+ * File-based JSON storage
66
+ * Schema-driven design
67
+ * Auto primary key
68
+ * Simple CRUD API
69
+ * Zero dependencies
70
+
71
+ ---
72
+
73
+ ## Links
74
+
75
+ GitHub: https://github.com/keshavsoft/kschema
76
+ NPM: https://www.npmjs.com/package/@keshavsoft/kschema
77
+ Website: https://keshavsoft.com
78
+
79
+ ---
80
+
81
+ ## Contact
82
+
83
+ Email: founder@keshavsoft.com
84
+
85
+ ---
86
+
87
+ ## About
88
+
89
+ KeshavSoft builds simple and practical developer tools focused on clarity, speed, and real-world usage.
90
+
91
+ ---
92
+
93
+ ## License
94
+
95
+ MIT License — see LICENSE file
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ // index.d.ts
2
+
3
+ export function sendToTally(Id: string): Promise<any>;
4
+
5
+ export function ledger(): Promise<any>;
6
+
7
+ export function stockItems(): Promise<any>;
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/v1/index.js";
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@keshavsoft/tallyextract",
3
+ "version": "1.1.2",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "sideEffects": false,
8
+
9
+ "exports": {
10
+ ".": "./index.js",
11
+ "./v1": "./src/v1/index.js"
12
+ },
13
+
14
+ "files": [
15
+ "src",
16
+ "index.js",
17
+ "index.d.ts",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+
22
+ "homepage": "https://keshavsoft.com",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/keshavsoft/tallyExtract"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/keshavsoft/tallyExtract/issues"
29
+ }
30
+ }
@@ -0,0 +1,10 @@
1
+ let _config = null;
2
+
3
+ export const loadConfig = (config) => {
4
+ _config = config;
5
+ };
6
+
7
+ export const getConfig = () => {
8
+ if (!_config) throw new Error("Config not loaded");
9
+ return _config;
10
+ };
@@ -0,0 +1,15 @@
1
+ // helpers/getLatestVersion.js
2
+ import fs from "fs";
3
+ import path from "path";
4
+
5
+ export default function getLatestVersion(baseDir = path.resolve("src")) {
6
+ const items = fs.readdirSync(baseDir, { withFileTypes: true });
7
+
8
+ const versions = items
9
+ .filter(d => d.isDirectory() && /^v\d+$/.test(d.name))
10
+ .map(d => Number(d.name.slice(1)));
11
+
12
+ if (versions.length === 0) return 1;
13
+
14
+ return Math.max(...versions);
15
+ };
@@ -0,0 +1,57 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { kschema } from "../v12/index.js";
4
+
5
+ const OUTPUT_DIR = path.resolve("samples");
6
+
7
+ if (!fs.existsSync(OUTPUT_DIR)) {
8
+ fs.mkdirSync(OUTPUT_DIR, { recursive: true });
9
+ }
10
+
11
+ const table = kschema.table("SampleTable");
12
+
13
+ // Query methods
14
+ Object.keys(table.query).forEach((key) => {
15
+ if (key === "aggregate") return;
16
+
17
+ const filePath = path.join(OUTPUT_DIR, `query_${key}.js`);
18
+
19
+ const content = `import { kschema } from "@keshavsoft/kschema";
20
+
21
+ const table = kschema.table("SampleTable");
22
+
23
+ console.log(table.query.${key}());
24
+ `;
25
+
26
+ fs.writeFileSync(filePath, content);
27
+ });
28
+
29
+ // Aggregate
30
+ Object.keys(table.query.aggregate || {}).forEach((key) => {
31
+ const filePath = path.join(OUTPUT_DIR, `aggregate_${key}.js`);
32
+
33
+ const content = `import { kschema } from "@keshavsoft/kschema";
34
+
35
+ const table = kschema.table("SampleTable");
36
+
37
+ console.log(table.query.aggregate.${key}());
38
+ `;
39
+
40
+ fs.writeFileSync(filePath, content);
41
+ });
42
+
43
+ // Mutate
44
+ Object.keys(table.mutate).forEach((key) => {
45
+ const filePath = path.join(OUTPUT_DIR, `mutate_${key}.js`);
46
+
47
+ const content = `import { kschema } from "@keshavsoft/kschema";
48
+
49
+ const table = kschema.table("SampleTable");
50
+
51
+ console.log(table.mutate.${key}({}));
52
+ `;
53
+
54
+ fs.writeFileSync(filePath, content);
55
+ });
56
+
57
+ console.log("Samples generated 🚀");
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.query.aggregate.count());
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.deleteWithChecks({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.insertAsIs({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.insertFlat({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.insertGenPk({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.insertWithChecks({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.mutate.updateWithChecks({}));
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.query.filterByColumns());
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.query.filterByPk());
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.query.findAll());
@@ -0,0 +1,5 @@
1
+ import { kschema } from "@keshavsoft/kschema";
2
+
3
+ const table = kschema.table("SampleTable");
4
+
5
+ console.log(table.query.findByPk());
@@ -0,0 +1,16 @@
1
+ // scripts/updateIndex.js
2
+ import fs from "fs";
3
+ import path from "path";
4
+
5
+ import getLatestVersion from "../helpers/getLatestVersion.js";
6
+
7
+ const latest = getLatestVersion("./src");
8
+
9
+ const rootIndex = path.resolve("./index.js");
10
+
11
+ fs.writeFileSync(
12
+ rootIndex,
13
+ `export * from "./src/v${latest}/index.js";\n`
14
+ );
15
+
16
+ console.log("Updated to v" + latest);
@@ -0,0 +1,3 @@
1
+ export const buildDataPath = (cfg, fileName) => {
2
+ return `${cfg.DataPath}/${fileName}.json`;
3
+ };
@@ -0,0 +1,121 @@
1
+ {
2
+ "stockitemname": "",
3
+ "gstovrdnisrevchargeappl": "\u0004 Not Applicable",
4
+ "gstovrdntaxability": "Taxable",
5
+ "gstsourcetype": "Stock Item",
6
+ "gstitemsource": "",
7
+ "hsnsourcetype": "Stock Item",
8
+ "hsnitemsource": "",
9
+ "gstovrdntypeofsupply": "Goods",
10
+ "gstrateinferapplicability": "As per Masters/Company",
11
+ "gsthsnname": "540720",
12
+ "gsthsndescription": "Woven Fabric",
13
+ "gsthsninferapplicability": "As per Masters/Company",
14
+ "isdeemedpositive": false,
15
+ "isgstassessablevalueoverridden": false,
16
+ "strdisgstapplicable": false,
17
+ "contentnegispos": false,
18
+ "islastdeemedpositive": false,
19
+ "isautonegate": false,
20
+ "iscustomsclearance": false,
21
+ "istrackcomponent": false,
22
+ "istrackproduction": false,
23
+ "isprimaryitem": false,
24
+ "isscrap": false,
25
+ "rate": "100.00/Nos",
26
+ "amount": "1000.00",
27
+ "actualqty": " 10 Nos",
28
+ "billedqty": " 10 Nos",
29
+ "mrprate": "100.00/Nos",
30
+ "batchallocations": [
31
+ {
32
+ "godownname": "Main Location",
33
+ "batchname": "Primary Batch",
34
+ "indentno": "\u0004 Not Applicable",
35
+ "orderno": "\u0004 Not Applicable",
36
+ "trackingnumber": "\u0004 Not Applicable",
37
+ "dynamiccstiscleared": false,
38
+ "amount": "1000.00",
39
+ "actualqty": " 10 Nos",
40
+ "billedqty": " 10 Nos"
41
+ }
42
+ ],
43
+ "accountingallocations": [
44
+ {
45
+ "oldauditentryids": [
46
+ {
47
+ "metadata": true,
48
+ "type": "Number"
49
+ },
50
+ "-1"
51
+ ],
52
+ "ledgername": "GST SALES",
53
+ "classrate": "100.00000",
54
+ "gstclass": "\u0004 Not Applicable",
55
+ "isdeemedpositive": false,
56
+ "ledgerfromitem": false,
57
+ "removezeroentries": false,
58
+ "ispartyledger": false,
59
+ "gstoverridden": false,
60
+ "isgstassessablevalueoverridden": false,
61
+ "strdisgstapplicable": false,
62
+ "strdgstispartyledger": false,
63
+ "strdgstisdutyledger": false,
64
+ "contentnegispos": false,
65
+ "islastdeemedpositive": false,
66
+ "iscapvattaxaltered": false,
67
+ "iscapvatnotclaimed": false,
68
+ "amount": "1000.00"
69
+ }
70
+ ],
71
+ "ratedetails": [
72
+ {
73
+ "gstratedutyhead": "CGST",
74
+ "gstratevaluationtype": "Based on Value",
75
+ "gstrate": " 2.50"
76
+ },
77
+ {
78
+ "gstratedutyhead": "SGST/UTGST",
79
+ "gstratevaluationtype": "Based on Value",
80
+ "gstrate": " 2.50"
81
+ },
82
+ {
83
+ "gstratedutyhead": "IGST",
84
+ "gstratevaluationtype": "Based on Value",
85
+ "gstrate": " 5"
86
+ },
87
+ {
88
+ "gstratedutyhead": "Cess",
89
+ "gstratevaluationtype": "\u0004 Not Applicable"
90
+ },
91
+ {
92
+ "gstratedutyhead": "State Cess",
93
+ "gstratevaluationtype": "Based on Value"
94
+ }
95
+ ],
96
+ "ratedetails1": [
97
+ {
98
+ "gstratedutyhead": "CGST",
99
+ "gstratevaluationtype": "Based on Value",
100
+ "gstrate": " 9"
101
+ },
102
+ {
103
+ "gstratedutyhead": "SGST/UTGST",
104
+ "gstratevaluationtype": "Based on Value",
105
+ "gstrate": " 9"
106
+ },
107
+ {
108
+ "gstratedutyhead": "IGST",
109
+ "gstratevaluationtype": "Based on Value",
110
+ "gstrate": " 18"
111
+ },
112
+ {
113
+ "gstratedutyhead": "Cess",
114
+ "gstratevaluationtype": "\u0004 Not Applicable"
115
+ },
116
+ {
117
+ "gstratedutyhead": "State Cess",
118
+ "gstratevaluationtype": "Based on Value"
119
+ }
120
+ ]
121
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "oldauditentryids": [
3
+ {
4
+ "metadata": true,
5
+ "type": "Number"
6
+ },
7
+ "-1"
8
+ ],
9
+ "roundtype": "\u0004 Not Applicable",
10
+ "ledgername": "SGST Output",
11
+ "methodtype": "GST",
12
+ "gstclass": "\u0004 Not Applicable",
13
+ "isdeemedpositive": false,
14
+ "ledgerfromitem": false,
15
+ "removezeroentries": true,
16
+ "ispartyledger": false,
17
+ "gstoverridden": false,
18
+ "isgstassessablevalueoverridden": false,
19
+ "strdisgstapplicable": false,
20
+ "strdgstispartyledger": false,
21
+ "strdgstisdutyledger": false,
22
+ "contentnegispos": false,
23
+ "islastdeemedpositive": false,
24
+ "iscapvattaxaltered": false,
25
+ "iscapvatnotclaimed": false,
26
+ "amount": "90.00",
27
+ "vatexpamount": "90.00"
28
+ }