@keshavsoft/tallyextract 1.8.1 → 1.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keshavsoft/tallyextract",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,5 +1,5 @@
1
1
  // src/v1/api/stockItems.js
2
- import { sendToTally } from "../core/sendToTally.js";
2
+ import { sendToTally } from "../core/sendToTallyV1.js";
3
3
 
4
4
  export function stockItems({ inSvCurrentCompany }) {
5
5
  // return sendToTally("KeshavStockItems");
@@ -1,26 +1,18 @@
1
1
  // src/v1/core/sendToTally.js
2
2
  const BODY = {
3
3
  static_variables: [
4
- { name: "svExportFormat", value: "jsonex" },
5
- {
6
- name: "svCurrentCompany",
7
- value: "Mani9"
8
- }
4
+ { name: "svExportFormat", value: "jsonex" }
9
5
  ]
10
6
  };
11
7
 
12
- export async function sendToTally({ inTdlName, url = "http://localhost:9000",
13
- inSvCurrentCompany = "Mani9"
14
- }) {
15
- BODY.static_variables[1].value = inSvCurrentCompany;
16
-
8
+ export async function sendToTally(Id, url = "http://localhost:9000") {
17
9
  const res = await fetch(url, {
18
10
  method: "POST",
19
11
  headers: {
20
12
  "Content-Type": "application/json",
21
13
  "TallyRequest": "Export",
22
14
  "Type": "Collection",
23
- "Id": inTdlName
15
+ "Id": Id
24
16
  },
25
17
  body: JSON.stringify(BODY)
26
18
  });
@@ -0,0 +1,29 @@
1
+ // src/v1/core/sendToTally.js
2
+ const BODY = {
3
+ static_variables: [
4
+ { name: "svExportFormat", value: "jsonex" },
5
+ {
6
+ name: "svCurrentCompany",
7
+ value: "Mani9"
8
+ }
9
+ ]
10
+ };
11
+
12
+ export async function sendToTally({ inTdlName, url = "http://localhost:9000",
13
+ inSvCurrentCompany = "Mani9"
14
+ }) {
15
+ BODY.static_variables[1].value = inSvCurrentCompany;
16
+
17
+ const res = await fetch(url, {
18
+ method: "POST",
19
+ headers: {
20
+ "Content-Type": "application/json",
21
+ "TallyRequest": "Export",
22
+ "Type": "Collection",
23
+ "Id": inTdlName
24
+ },
25
+ body: JSON.stringify(BODY)
26
+ });
27
+
28
+ return res.json();
29
+ };