tally-http-json 1.5.1 → 1.6.1

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": "tally-http-json",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "Tally HTTP JSON client for TallyPrime",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -1 +1 @@
1
- export { default, noCompany, tdl, fromCollection, importLedger } from "./v5/index.js";
1
+ export { default, noCompany, tdl, fromCollection, importLedger } from "./v6/index.js";
@@ -0,0 +1,9 @@
1
+ {
2
+ "static_variables": [
3
+ {
4
+ "name": "svExportFormat",
5
+ "value": "jsonex"
6
+ }
7
+ ],
8
+ "fetch_list": []
9
+ }
@@ -0,0 +1,18 @@
1
+ import transport from "../transport.js";
2
+ import body from "./body.json" with { type: "json" };
3
+
4
+ const startFunc = async ({
5
+ inHeaderId,
6
+ inUrl = "http://localhost:9000"
7
+ } = {}) => {
8
+ const localHeaderId = inHeaderId;
9
+ const localUrl = inUrl;
10
+
11
+ return transport({
12
+ inHeaderId: localHeaderId,
13
+ inUrl: localUrl,
14
+ inBodyAsJson: JSON.stringify(body)
15
+ });
16
+ };
17
+
18
+ export default startFunc;
@@ -0,0 +1,23 @@
1
+ {
2
+ "static_variables": [
3
+ {
4
+ "name": "svMstImportFormat",
5
+ "value": "JSONEx"
6
+ },
7
+ {
8
+ "name": "svCurrentCompany",
9
+ "value": "mani9"
10
+ }
11
+ ],
12
+ "tallymessage": [
13
+ {
14
+ "metadata": {
15
+ "type": "Ledger",
16
+ "action": "create",
17
+ "name": "aaaaa"
18
+ },
19
+ "name": "aaaaaaa",
20
+ "parent": "Sundry Debtors"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,16 @@
1
+ import transport from "../transport.js";
2
+ import body from "./body.json" with { type: "json" };
3
+
4
+ const startFunc = async (name) => {
5
+ body.tallymessage[0].metadata.name = name;
6
+ body.tallymessage[0].name = name;
7
+
8
+ return await transport({
9
+ inHeaderId: "All Masters",
10
+ inTallyrequest: "Import",
11
+ inType: "Data",
12
+ inBodyAsJson: JSON.stringify(body)
13
+ });
14
+ };
15
+
16
+ export default startFunc;
@@ -0,0 +1,23 @@
1
+ import noCompanyFromInternal from "./noCompany/index.js";
2
+ import tdlFromInternal from "./tdl/index.js";
3
+ import fromCollectionInternal from "./fromCollection/index.js";
4
+ import fromimport from "./import/index.js";
5
+
6
+ const noCompany = async (headerId = "") => {
7
+ return await noCompanyFromInternal({ inHeaderId: headerId });
8
+ };
9
+
10
+ const fromCollection = async (headerId = "") => {
11
+ return await fromCollectionInternal({ inHeaderId: headerId });
12
+ };
13
+
14
+ const tdl = async (headerId = "", tdl) => {
15
+ return await tdlFromInternal({ inHeaderId: headerId, inTdl: tdl });
16
+ };
17
+
18
+ const importLedger = async (name) => {
19
+ return await fromimport(name);
20
+ };
21
+
22
+ export default noCompany;
23
+ export { noCompany, tdl, fromCollection, importLedger };
@@ -0,0 +1,9 @@
1
+ {
2
+ "static_variables": [
3
+ {
4
+ "name": "svExportFormat",
5
+ "value": "jsonex"
6
+ }
7
+ ],
8
+ "fetch_list": []
9
+ }
@@ -0,0 +1,18 @@
1
+ import transport from "../transport.js";
2
+ import body from "./body.json" with { type: "json" };
3
+
4
+ const startFunc = async ({
5
+ inHeaderId,
6
+ inUrl = "http://localhost:9000"
7
+ } = {}) => {
8
+ const localHeaderId = inHeaderId;
9
+ const localUrl = inUrl;
10
+
11
+ return transport({
12
+ inHeaderId: localHeaderId,
13
+ inUrl: localUrl,
14
+ inBodyAsJson: JSON.stringify(body)
15
+ });
16
+ };
17
+
18
+ export default startFunc;
@@ -0,0 +1,9 @@
1
+ {
2
+ "static_variables": [
3
+ {
4
+ "name": "svExportFormat",
5
+ "value": "jsonex"
6
+ }
7
+ ],
8
+ "fetch_list": []
9
+ }
@@ -0,0 +1,23 @@
1
+ import transport from "../transport.js";
2
+ import body from "./body.json" with { type: "json" };
3
+
4
+ const startFunc = async ({
5
+ inHeaderId,
6
+ inUrl = "http://localhost:9000",
7
+ inTdl
8
+ } = {}) => {
9
+ const localHeaderId = inHeaderId;
10
+ const localUrl = inUrl;
11
+
12
+ if (inTdl) {
13
+ body.tdlmessage = inTdl;
14
+ };
15
+
16
+ return transport({
17
+ inHeaderId: localHeaderId,
18
+ inUrl: localUrl,
19
+ inBodyAsJson: JSON.stringify(body)
20
+ });
21
+ };
22
+
23
+ export default startFunc;
@@ -0,0 +1,26 @@
1
+ const startFunc = async ({ inBodyAsJson, inHeaderId,
2
+ inUrl = "http://localhost:9000",
3
+ inTallyrequest = "Export",
4
+ inType = "Collection"
5
+ }) => {
6
+
7
+ const localBodyAsJson = inBodyAsJson;
8
+ const localHeaderId = inHeaderId;
9
+ const localUrl = inUrl;
10
+
11
+ const response = await fetch(localUrl, {
12
+ method: "POST",
13
+ headers: {
14
+ "Content-Type": "application/json",
15
+ "version": "1",
16
+ "tallyrequest": inTallyrequest,
17
+ "type": inType,
18
+ "id": localHeaderId
19
+ },
20
+ body: localBodyAsJson
21
+ });
22
+
23
+ return await response.json();
24
+ };
25
+
26
+ export default startFunc;