tally-http-json 1.2.2 → 1.3.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": "tally-http-json",
3
- "version": "1.2.2",
3
+ "version": "1.3.2",
4
4
  "description": "Tally HTTP JSON client for TallyPrime",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -34,6 +34,6 @@
34
34
  },
35
35
  "devDependencies": {},
36
36
  "dependencies": {
37
- "tally-spec": "^1.5.1"
37
+ "tally-spec": "^1.5.2"
38
38
  }
39
39
  }
package/src/index.js CHANGED
@@ -1 +1 @@
1
- export { default, noCompany } from "./v2/index.js";
1
+ export { default, noCompany, tdl } from "./v3/index.js";
@@ -0,0 +1,13 @@
1
+ import noCompanyFromInternal from "./noCompany/index.js";
2
+ import tdlFromInternal from "./tdl/index.js";
3
+
4
+ const noCompany = async (headerId = "") => {
5
+ return await noCompanyFromInternal({ inHeaderId: headerId });
6
+ };
7
+
8
+ const tdl = async (headerId = "", tdl) => {
9
+ return await tdlFromInternal({ inHeaderId: headerId, inTdl: tdl });
10
+ };
11
+
12
+ export default noCompany;
13
+ export { noCompany, tdl };
@@ -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,21 @@
1
+ const startFunc = async ({ inBodyAsJson, inHeaderId, inUrl = "http://localhost:9000" }) => {
2
+ const localBodyAsJson = inBodyAsJson;
3
+ const localHeaderId = inHeaderId;
4
+ const localUrl = inUrl;
5
+
6
+ const response = await fetch(localUrl, {
7
+ method: "POST",
8
+ headers: {
9
+ "Content-Type": "application/json",
10
+ "version": "1",
11
+ "tallyrequest": "Export",
12
+ "type": "Collection",
13
+ "id": localHeaderId
14
+ },
15
+ body: localBodyAsJson
16
+ });
17
+
18
+ return await response.json();
19
+ };
20
+
21
+ export default startFunc;