tally-xml-tdl 1.27.1 → 1.31.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.
Files changed (207) hide show
  1. package/index.d.ts +83 -65
  2. package/package.json +10 -3
  3. package/src/index.js +2 -2
  4. package/src/v25/engine/dispatchTally/buildXml/buildXml.js +45 -45
  5. package/src/v25/engine/dispatchTally/buildXml/templates.js +42 -42
  6. package/src/v25/engine/dispatchTally/index.js +25 -25
  7. package/src/v25/engine/dispatchTally/parseResponse.js +13 -13
  8. package/src/v25/engine/dispatchTally/transport.js +16 -16
  9. package/src/v25/engine/getEndpointSpec/index.js +12 -12
  10. package/src/v25/engine/index.js +24 -24
  11. package/src/v25/engine/validateInput/index.js +19 -19
  12. package/src/v25/index.js +8 -8
  13. package/src/v26/engine/dispatchTally/buildXml/buildXml.js +45 -45
  14. package/src/v26/engine/dispatchTally/buildXml/templates.js +42 -42
  15. package/src/v26/engine/dispatchTally/index.js +25 -25
  16. package/src/v26/engine/dispatchTally/parseResponse.js +13 -13
  17. package/src/v26/engine/dispatchTally/transport.js +16 -16
  18. package/src/v26/engine/getEndpointSpec/index.js +12 -12
  19. package/src/v26/engine/index.js +24 -24
  20. package/src/v26/engine/validateInput/index.js +19 -19
  21. package/src/v26/index.js +10 -10
  22. package/src/v27/engine/dispatchTally/buildXml/buildXml.js +45 -45
  23. package/src/v27/engine/dispatchTally/buildXml/templates.js +42 -42
  24. package/src/v27/engine/dispatchTally/index.js +20 -20
  25. package/src/v27/engine/dispatchTally/transport.js +16 -16
  26. package/src/v27/engine/getEndpointSpec/index.js +12 -12
  27. package/src/v27/engine/index.js +24 -24
  28. package/src/v27/engine/validateInput/index.js +19 -19
  29. package/src/v27/index.js +10 -10
  30. package/src/v28/apiTree/blueprint/api.json +13 -0
  31. package/src/v28/apiTree/blueprint/source.json +228 -0
  32. package/src/v28/apiTree/engine/caller/index.js +65 -0
  33. package/src/v28/apiTree/engine/guards/index.js +23 -0
  34. package/src/v28/apiTree/engine/guards/isFunction.js +9 -0
  35. package/src/v28/apiTree/engine/guards/isObject.js +9 -0
  36. package/src/v28/apiTree/engine/guards/isStringArray.js +15 -0
  37. package/src/v28/apiTree/engine/run.js +16 -0
  38. package/src/v28/apiTree/engine/toTransformRecipe.js +53 -0
  39. package/src/v28/apiTree/engine/traversal/ifTransformFound/index.js +49 -0
  40. package/src/v28/apiTree/engine/traversal/index.js +34 -0
  41. package/src/v28/apiTree/engine/traversal/traverseArray/index.js +21 -0
  42. package/src/v28/apiTree/engine/traversal/traverseObject/index.js +50 -0
  43. package/src/v28/apiTree/index.js +32 -0
  44. package/src/v28/apiTreeV1/blueprint/api.json +13 -0
  45. package/src/v28/apiTreeV1/blueprint/source.json +228 -0
  46. package/src/v28/apiTreeV1/engine/caller/index.js +65 -0
  47. package/src/v28/apiTreeV1/engine/guards/index.js +23 -0
  48. package/src/v28/apiTreeV1/engine/guards/isFunction.js +9 -0
  49. package/src/v28/apiTreeV1/engine/guards/isObject.js +9 -0
  50. package/src/v28/apiTreeV1/engine/guards/isStringArray.js +15 -0
  51. package/src/v28/apiTreeV1/engine/run.js +16 -0
  52. package/src/v28/apiTreeV1/engine/toTransformRecipe.js +53 -0
  53. package/src/v28/apiTreeV1/engine/traversal/ifTransformFound/index.js +49 -0
  54. package/src/v28/apiTreeV1/engine/traversal/index.js +34 -0
  55. package/src/v28/apiTreeV1/engine/traversal/traverseArray/index.js +21 -0
  56. package/src/v28/apiTreeV1/engine/traversal/traverseObject/index.js +50 -0
  57. package/src/v28/apiTreeV1/index.js +32 -0
  58. package/src/{v24/engine/execution → v28/engine/dispatchTally/buildXml}/buildXml.js +45 -54
  59. package/src/{v24/engine/execution → v28/engine/dispatchTally/buildXml}/templates.js +42 -42
  60. package/src/v28/engine/dispatchTally/index.js +20 -0
  61. package/src/{v24/engine/execution → v28/engine/dispatchTally}/transport.js +16 -16
  62. package/src/{v24/engine/execution/getEndpointSpec.js → v28/engine/getEndpointSpec/index.js} +12 -12
  63. package/src/{v24/engine/execution → v28/engine}/index.js +25 -27
  64. package/src/{v24/engine/execution/validateInput.js → v28/engine/validateInput/index.js} +19 -19
  65. package/src/v28/index.js +13 -0
  66. package/src/v28/tallySpec/recipe.json +92 -0
  67. package/src/v28/tallySpec/source.json +228 -0
  68. package/src/v29/apiTree/blueprint/api.json +13 -0
  69. package/src/v29/apiTree/blueprint/source.json +228 -0
  70. package/src/v29/apiTree/engine/caller/index.js +65 -0
  71. package/src/v29/apiTree/engine/guards/index.js +23 -0
  72. package/src/v29/apiTree/engine/guards/isFunction.js +9 -0
  73. package/src/v29/apiTree/engine/guards/isObject.js +9 -0
  74. package/src/v29/apiTree/engine/guards/isStringArray.js +15 -0
  75. package/src/v29/apiTree/engine/run.js +16 -0
  76. package/src/v29/apiTree/engine/toTransformRecipe.js +53 -0
  77. package/src/v29/apiTree/engine/traversal/ifTransformFound/index.js +49 -0
  78. package/src/v29/apiTree/engine/traversal/index.js +34 -0
  79. package/src/v29/apiTree/engine/traversal/traverseArray/index.js +21 -0
  80. package/src/v29/apiTree/engine/traversal/traverseObject/index.js +50 -0
  81. package/src/v29/apiTree/index.js +32 -0
  82. package/src/v29/apiTreeV1/blueprint/api.json +13 -0
  83. package/src/v29/apiTreeV1/blueprint/source.json +228 -0
  84. package/src/v29/apiTreeV1/engine/caller/index.js +65 -0
  85. package/src/v29/apiTreeV1/engine/guards/index.js +23 -0
  86. package/src/v29/apiTreeV1/engine/guards/isFunction.js +9 -0
  87. package/src/v29/apiTreeV1/engine/guards/isObject.js +9 -0
  88. package/src/v29/apiTreeV1/engine/guards/isStringArray.js +15 -0
  89. package/src/v29/apiTreeV1/engine/run.js +16 -0
  90. package/src/v29/apiTreeV1/engine/toTransformRecipe.js +53 -0
  91. package/src/v29/apiTreeV1/engine/traversal/ifTransformFound/index.js +49 -0
  92. package/src/v29/apiTreeV1/engine/traversal/index.js +34 -0
  93. package/src/v29/apiTreeV1/engine/traversal/traverseArray/index.js +21 -0
  94. package/src/v29/apiTreeV1/engine/traversal/traverseObject/index.js +50 -0
  95. package/src/v29/apiTreeV1/index.js +32 -0
  96. package/src/v29/engine/dispatchTally/buildXml/buildXml.js +45 -0
  97. package/src/v29/engine/dispatchTally/buildXml/templates.js +42 -0
  98. package/src/v29/engine/dispatchTally/index.js +20 -0
  99. package/src/v29/engine/dispatchTally/transport.js +16 -0
  100. package/src/v29/engine/getEndpointSpec/index.js +12 -0
  101. package/src/v29/engine/index.js +25 -0
  102. package/src/v29/engine/validateInput/index.js +19 -0
  103. package/src/v29/index.js +31 -0
  104. package/src/v29/tallySpec/recipe.json +92 -0
  105. package/src/v29/tallySpec/source.json +228 -0
  106. package/src/v30/index.js +41 -0
  107. package/src/v31/company/index.js +15 -0
  108. package/src/{v21 → v31}/index.js +6 -6
  109. package/src/v31/masters/index.js +16 -0
  110. package/src/v31/vouchers/index.js +25 -0
  111. package/src/v20/company/body.xml +0 -25
  112. package/src/v20/company/index.js +0 -29
  113. package/src/v20/company/tdl.json +0 -4
  114. package/src/v20/core/buildXml.js +0 -9
  115. package/src/v20/core/execute/executeXml.js +0 -16
  116. package/src/v20/core/execute/index.js +0 -4
  117. package/src/v20/core/index.js +0 -22
  118. package/src/v20/core/response/index.js +0 -2
  119. package/src/v20/core/response/xmlToJson.js +0 -18
  120. package/src/v20/core/transport/http.js +0 -40
  121. package/src/v20/core/transport/index.js +0 -1
  122. package/src/v20/index.js +0 -6
  123. package/src/v20/masters/body.xml +0 -25
  124. package/src/v20/masters/index.js +0 -39
  125. package/src/v20/masters/masters.json +0 -86
  126. package/src/v20/vouchers/body.xml +0 -25
  127. package/src/v20/vouchers/createVoucherApi.js +0 -38
  128. package/src/v20/vouchers/index.js +0 -5
  129. package/src/v20/vouchers/purchases/index.js +0 -7
  130. package/src/v20/vouchers/sales/index.js +0 -7
  131. package/src/v20/vouchers/tdlMessage.json +0 -4
  132. package/src/v21/body.xml +0 -25
  133. package/src/v21/company/index.js +0 -7
  134. package/src/v21/core/buildXml.js +0 -9
  135. package/src/v21/core/execute/executeXml.js +0 -16
  136. package/src/v21/core/execute/index.js +0 -4
  137. package/src/v21/core/index.js +0 -22
  138. package/src/v21/core/response/index.js +0 -2
  139. package/src/v21/core/response/xmlToJson.js +0 -18
  140. package/src/v21/core/transport/http.js +0 -40
  141. package/src/v21/core/transport/index.js +0 -1
  142. package/src/v21/createApi.js +0 -74
  143. package/src/v21/masters/index.js +0 -30
  144. package/src/v21/tdlMessage.json +0 -18
  145. package/src/v21/vouchers/index.js +0 -5
  146. package/src/v21/vouchers/purchases/index.js +0 -7
  147. package/src/v21/vouchers/sales/index.js +0 -7
  148. package/src/v22/body.xml +0 -25
  149. package/src/v22/bodyAsData.xml +0 -16
  150. package/src/v22/company/index.js +0 -7
  151. package/src/v22/core/buildXml.js +0 -9
  152. package/src/v22/core/execute/executeXml.js +0 -16
  153. package/src/v22/core/execute/index.js +0 -4
  154. package/src/v22/core/index.js +0 -22
  155. package/src/v22/core/response/index.js +0 -2
  156. package/src/v22/core/response/xmlToJson.js +0 -18
  157. package/src/v22/core/transport/http.js +0 -40
  158. package/src/v22/core/transport/index.js +0 -1
  159. package/src/v22/createApi.js +0 -106
  160. package/src/v22/index.js +0 -7
  161. package/src/v22/masters/Godown/index.js +0 -20
  162. package/src/v22/masters/Ledger/index.js +0 -22
  163. package/src/v22/masters/StockGroup/index.js +0 -18
  164. package/src/v22/masters/StockItem/index.js +0 -20
  165. package/src/v22/masters/Unit/index.js +0 -16
  166. package/src/v22/masters/index.js +0 -64
  167. package/src/v22/reports/index.js +0 -11
  168. package/src/v22/reports/stockSummary/index.js +0 -10
  169. package/src/v22/reports.json +0 -6
  170. package/src/v22/tdlMessage.json +0 -37
  171. package/src/v22/vouchers/index.js +0 -5
  172. package/src/v22/vouchers/purchases/index.js +0 -7
  173. package/src/v22/vouchers/sales/index.js +0 -7
  174. package/src/v23/body.xml +0 -25
  175. package/src/v23/bodyAsData.xml +0 -16
  176. package/src/v23/company/index.js +0 -7
  177. package/src/v23/core/buildXml.js +0 -9
  178. package/src/v23/core/execute/executeXml.js +0 -16
  179. package/src/v23/core/execute/index.js +0 -4
  180. package/src/v23/core/index.js +0 -22
  181. package/src/v23/core/response/index.js +0 -2
  182. package/src/v23/core/response/xmlToJson.js +0 -18
  183. package/src/v23/core/transport/http.js +0 -40
  184. package/src/v23/core/transport/index.js +0 -1
  185. package/src/v23/createApi.js +0 -106
  186. package/src/v23/index.js +0 -7
  187. package/src/v23/masters/Godown/index.js +0 -20
  188. package/src/v23/masters/Ledger/index.js +0 -22
  189. package/src/v23/masters/StockGroup/index.js +0 -18
  190. package/src/v23/masters/StockItem/index.js +0 -20
  191. package/src/v23/masters/Unit/index.js +0 -16
  192. package/src/v23/masters/index.js +0 -64
  193. package/src/v23/reports/index.js +0 -11
  194. package/src/v23/reports/stockSummary/index.js +0 -10
  195. package/src/v23/reports.json +0 -6
  196. package/src/v23/tdlMessage.json +0 -37
  197. package/src/v23/vouchers/index.js +0 -5
  198. package/src/v23/vouchers/purchases/index.js +0 -7
  199. package/src/v23/vouchers/sales/index.js +0 -7
  200. package/src/v24/api.json +0 -17
  201. package/src/v24/engine/execution/dispatchTally.js +0 -29
  202. package/src/v24/engine/execution/parseResponse.js +0 -13
  203. package/src/v24/engine/route/attachPath.js +0 -25
  204. package/src/v24/engine/route/createLeafHandler.js +0 -19
  205. package/src/v24/engine/route/index.js +0 -24
  206. package/src/v24/index.js +0 -12
  207. package/src/v24/source.json +0 -119
package/index.d.ts CHANGED
@@ -1,65 +1,83 @@
1
- /**
2
- * Generated by create-intellisense from src/v24.
3
- * Do not edit this file directly.
4
- */
5
-
6
- export type TallyApi = {
7
- company: {
8
- /** Fetches company list from Tally. */
9
- fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
10
- };
11
- vouchers: {
12
- purchases: {
13
- /** Fetches purchase vouchers. */
14
- fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
15
- };
16
- sales: {
17
- /** Fetches sales vouchers. */
18
- fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
19
- };
20
- };
21
- masters: {
22
- unit: {
23
- /** Fetches all units. */
24
- all: (inParam: string, ...inArgs: any[]) => Promise<any>;
25
- };
26
- stockItem: {
27
- /** Fetches all stock items. */
28
- all: (inParam: string, ...inArgs: any[]) => Promise<any>;
29
- /** Fetches stock items with base units. */
30
- withBaseUnits: (inParam: string, ...inArgs: any[]) => Promise<any>;
31
- /** Fetches stock items with batches. */
32
- withBatches: (inParam: string, ...inArgs: any[]) => Promise<any>;
33
- };
34
- ledger: {
35
- /** Fetches all ledgers. */
36
- all: (inParam: string, ...inArgs: any[]) => Promise<any>;
37
- /** Fetches ledgers with GSTIN details. */
38
- withDetails: (inParam: string, ...inArgs: any[]) => Promise<any>;
39
- /** Fetches ledgers with full GST registration details. */
40
- withGstDetails: (inParam: string, ...inArgs: any[]) => Promise<any>;
41
- };
42
- stockGroup: {
43
- /** Fetches all stock groups. */
44
- all: (inParam: string, ...inArgs: any[]) => Promise<any>;
45
- /** Fetches stock groups with parent hierarchies. */
46
- withParent: (inParam: string, ...inArgs: any[]) => Promise<any>;
47
- };
48
- godown: {
49
- /** Fetches all godowns. */
50
- all: (inParam: string, ...inArgs: any[]) => Promise<any>;
51
- /** Fetches godowns with parent hierarchies. */
52
- withParent: (inParam: string, ...inArgs: any[]) => Promise<any>;
53
- };
54
- };
55
- reports: {
56
- stockSummary: {
57
- /** Fetches the Stock Summary report from Tally. */
58
- fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
59
- };
60
- };
61
- };
62
-
63
- declare const tally: TallyApi;
64
-
65
- export default tally;
1
+ /**
2
+ * Generated by create-intellisense from src/v27.
3
+ * Do not edit this file directly.
4
+ */
5
+
6
+ export type TallyApi = {
7
+ company: {
8
+ /** Fetches company list from Tally. */
9
+ fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
10
+ };
11
+ vouchers: {
12
+ purchases: {
13
+ /** Fetches purchase vouchers. */
14
+ fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
15
+ };
16
+ sales: {
17
+ /** Fetches sales vouchers. */
18
+ fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
19
+ };
20
+ };
21
+ masters: {
22
+ unit: {
23
+ /** Fetches all units. */
24
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
25
+ };
26
+ units: {
27
+ /** Fetches units master from Tally. */
28
+ fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
29
+ /** Fetches all units. */
30
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
31
+ };
32
+ stockItem: {
33
+ /** Fetches all stock items. */
34
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
35
+ /** Fetches stock items with base units. */
36
+ withBaseUnits: (inParam: string, ...inArgs: any[]) => Promise<any>;
37
+ /** Fetches stock items with batches. */
38
+ withBatches: (inParam: string, ...inArgs: any[]) => Promise<any>;
39
+ };
40
+ stockItems: {
41
+ /** Fetches stock items with batch allocations from Tally. */
42
+ withBatches: (inParam: string, ...inArgs: any[]) => Promise<any>;
43
+ };
44
+ ledger: {
45
+ /** Fetches all ledgers. */
46
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
47
+ /** Fetches ledgers with GSTIN details. */
48
+ withDetails: (inParam: string, ...inArgs: any[]) => Promise<any>;
49
+ /** Fetches ledgers with full GST registration details. */
50
+ withGstDetails: (inParam: string, ...inArgs: any[]) => Promise<any>;
51
+ };
52
+ ledgers: {
53
+ /** Fetches ledgers with GST registration details from Tally. */
54
+ withGstDetails: (inParam: string, ...inArgs: any[]) => Promise<any>;
55
+ };
56
+ stockGroup: {
57
+ /** Fetches all stock groups. */
58
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
59
+ /** Fetches stock groups with parent hierarchies. */
60
+ withParent: (inParam: string, ...inArgs: any[]) => Promise<any>;
61
+ };
62
+ stockGroups: {
63
+ /** Fetches stock groups with parent details from Tally. */
64
+ withParent: (inParam: string, ...inArgs: any[]) => Promise<any>;
65
+ };
66
+ godown: {
67
+ /** Fetches all godowns. */
68
+ all: (inParam: string, ...inArgs: any[]) => Promise<any>;
69
+ /** Fetches godowns with parent hierarchies. */
70
+ withParent: (inParam: string, ...inArgs: any[]) => Promise<any>;
71
+ };
72
+ };
73
+ reports: {
74
+ stockSummary: {
75
+ /** Fetches the Stock Summary report from Tally. */
76
+ fetch: (inParam: string, ...inArgs: any[]) => Promise<any>;
77
+ };
78
+ };
79
+ };
80
+
81
+ declare const tally: TallyApi;
82
+
83
+ export default tally;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tally-xml-tdl",
3
- "version": "1.27.1",
3
+ "version": "1.31.1",
4
4
  "description": "Simple, clean TDL and XML extraction and manipulation tools for Tally",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -29,8 +29,15 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/keshavsoft/tally-xml-tdl/issues"
31
31
  },
32
+ "scripts": {
33
+ "generate:dts": "create-intellisense",
34
+ "test": "node --test Test/v27/company.js Test/v27/index.js Test/v27/units.js"
35
+ },
36
+ "devDependencies": {
37
+ "create-intellisense": "^1.2.1"
38
+ },
32
39
  "dependencies": {
33
- "@keshavsoft/api-tree": "^11.1.1",
34
- "tally-spec": "^1.0.0"
40
+ "tally-extract": "^1.10.2",
41
+ "tally-spec": "^1.2.4"
35
42
  }
36
43
  }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { default } from "./v27/index.js";
2
- export * from "./v27/index.js";
1
+ export { company, masters, vouchers } from "./v31/index.js";
2
+ export { default } from "./v31/index.js";
@@ -1,45 +1,45 @@
1
- import { collectionTemplate, dataTemplate } from "./templates.js";
2
-
3
- const startFunc = ({ inEndpoint, inParam }) => {
4
- const localEndpoint = inEndpoint;
5
- const localParam = inParam;
6
-
7
- if (localEndpoint?.reportId) {
8
- let staticVars = "";
9
-
10
- if (typeof localParam === "string" && localParam.length > 0) {
11
- staticVars += `<SVCURRENTCOMPANY>${localParam}</SVCURRENTCOMPANY>`;
12
- } else if (typeof localParam === "object" && localParam?.company) {
13
- staticVars += `<SVCURRENTCOMPANY>${localParam.company}</SVCURRENTCOMPANY>`;
14
- }
15
-
16
- if (localEndpoint.staticVariables) {
17
- staticVars += localEndpoint.staticVariables;
18
- };
19
-
20
- return dataTemplate
21
- .replace("{{ID}}", localEndpoint.reportId)
22
- .replace("{{STATICVARIABLES}}", staticVars);
23
- }
24
-
25
- let staticVars = "";
26
-
27
- if (typeof localParam === "string" && localParam.length > 0) {
28
- staticVars += `<SVCURRENTCOMPANY>${localParam}</SVCURRENTCOMPANY>`;
29
- } else if (typeof localParam === "object" && localParam) {
30
- if (localParam.company) {
31
- staticVars += `<SVCURRENTCOMPANY>${localParam.company}</SVCURRENTCOMPANY>`;
32
- }
33
- if (localParam.fromDate && localParam.toDate) {
34
- staticVars += `<SVFROMDATE TYPE="Date">${localParam.fromDate}</SVFROMDATE><SVTODATE TYPE="Date">${localParam.toDate}</SVTODATE>`;
35
- }
36
- };
37
-
38
- const tdlMessage = localEndpoint?.tdl || "";
39
-
40
- return collectionTemplate
41
- .replace("{{STATICVARIABLES}}", staticVars)
42
- .replace("{{TDLMESSAGE}}", tdlMessage);
43
- };
44
-
45
- export default startFunc;
1
+ import { collectionTemplate, dataTemplate } from "./templates.js";
2
+
3
+ const startFunc = ({ inEndpoint, inParam }) => {
4
+ const localEndpoint = inEndpoint;
5
+ const localParam = inParam;
6
+
7
+ if (localEndpoint?.reportId) {
8
+ let staticVars = "";
9
+
10
+ if (typeof localParam === "string" && localParam.length > 0) {
11
+ staticVars += `<SVCURRENTCOMPANY>${localParam}</SVCURRENTCOMPANY>`;
12
+ } else if (typeof localParam === "object" && localParam?.company) {
13
+ staticVars += `<SVCURRENTCOMPANY>${localParam.company}</SVCURRENTCOMPANY>`;
14
+ }
15
+
16
+ if (localEndpoint.staticVariables) {
17
+ staticVars += localEndpoint.staticVariables;
18
+ };
19
+
20
+ return dataTemplate
21
+ .replace("{{ID}}", localEndpoint.reportId)
22
+ .replace("{{STATICVARIABLES}}", staticVars);
23
+ }
24
+
25
+ let staticVars = "";
26
+
27
+ if (typeof localParam === "string" && localParam.length > 0) {
28
+ staticVars += `<SVCURRENTCOMPANY>${localParam}</SVCURRENTCOMPANY>`;
29
+ } else if (typeof localParam === "object" && localParam) {
30
+ if (localParam.company) {
31
+ staticVars += `<SVCURRENTCOMPANY>${localParam.company}</SVCURRENTCOMPANY>`;
32
+ }
33
+ if (localParam.fromDate && localParam.toDate) {
34
+ staticVars += `<SVFROMDATE TYPE="Date">${localParam.fromDate}</SVFROMDATE><SVTODATE TYPE="Date">${localParam.toDate}</SVTODATE>`;
35
+ }
36
+ };
37
+
38
+ const tdlMessage = localEndpoint?.tdl || "";
39
+
40
+ return collectionTemplate
41
+ .replace("{{STATICVARIABLES}}", staticVars)
42
+ .replace("{{TDLMESSAGE}}", tdlMessage);
43
+ };
44
+
45
+ export default startFunc;
@@ -1,42 +1,42 @@
1
- const collectionTemplate = `<ENVELOPE>
2
- <HEADER>
3
- <VERSION>1</VERSION>
4
- <TALLYREQUEST>Export</TALLYREQUEST>
5
- <TYPE>Collection</TYPE>
6
- <ID>TDLID</ID>
7
- </HEADER>
8
- <BODY>
9
- <DESC>
10
- <STATICVARIABLES>
11
- <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
12
- {{STATICVARIABLES}}
13
- </STATICVARIABLES>
14
- <TDL>
15
- <TDLMESSAGE>
16
- <COLLECTION NAME="TDLID">
17
- {{TDLMESSAGE}}
18
- </COLLECTION>
19
- </TDLMESSAGE>
20
- </TDL>
21
- </DESC>
22
- </BODY>
23
- </ENVELOPE>`;
24
-
25
- const dataTemplate = `<ENVELOPE>
26
- <HEADER>
27
- <VERSION>1</VERSION>
28
- <TALLYREQUEST>Export</TALLYREQUEST>
29
- <TYPE>Data</TYPE>
30
- <ID>{{ID}}</ID>
31
- </HEADER>
32
- <BODY>
33
- <DESC>
34
- <STATICVARIABLES>
35
- <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
36
- {{STATICVARIABLES}}
37
- </STATICVARIABLES>
38
- </DESC>
39
- </BODY>
40
- </ENVELOPE>`;
41
-
42
- export { collectionTemplate, dataTemplate };
1
+ const collectionTemplate = `<ENVELOPE>
2
+ <HEADER>
3
+ <VERSION>1</VERSION>
4
+ <TALLYREQUEST>Export</TALLYREQUEST>
5
+ <TYPE>Collection</TYPE>
6
+ <ID>TDLID</ID>
7
+ </HEADER>
8
+ <BODY>
9
+ <DESC>
10
+ <STATICVARIABLES>
11
+ <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
12
+ {{STATICVARIABLES}}
13
+ </STATICVARIABLES>
14
+ <TDL>
15
+ <TDLMESSAGE>
16
+ <COLLECTION NAME="TDLID">
17
+ {{TDLMESSAGE}}
18
+ </COLLECTION>
19
+ </TDLMESSAGE>
20
+ </TDL>
21
+ </DESC>
22
+ </BODY>
23
+ </ENVELOPE>`;
24
+
25
+ const dataTemplate = `<ENVELOPE>
26
+ <HEADER>
27
+ <VERSION>1</VERSION>
28
+ <TALLYREQUEST>Export</TALLYREQUEST>
29
+ <TYPE>Data</TYPE>
30
+ <ID>{{ID}}</ID>
31
+ </HEADER>
32
+ <BODY>
33
+ <DESC>
34
+ <STATICVARIABLES>
35
+ <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
36
+ {{STATICVARIABLES}}
37
+ </STATICVARIABLES>
38
+ </DESC>
39
+ </BODY>
40
+ </ENVELOPE>`;
41
+
42
+ export { collectionTemplate, dataTemplate };
@@ -1,25 +1,25 @@
1
- import buildXml from "./buildXml/buildXml.js";
2
- import transport from "./transport.js";
3
- import parseResponse from "./parseResponse.js";
4
-
5
- const startFunc = async ({ inEndpoint, inParam }) => {
6
- const localEndpoint = inEndpoint;
7
- const localParam = inParam;
8
-
9
- const xml = buildXml({
10
- inEndpoint: localEndpoint,
11
- inParam: localParam
12
- });
13
-
14
- const rawResponse = await transport({
15
- inXml: xml
16
- });
17
-
18
- const parsedJson = parseResponse({
19
- inXml: rawResponse
20
- });
21
-
22
- return parsedJson;
23
- };
24
-
25
- export default startFunc;
1
+ import buildXml from "./buildXml/buildXml.js";
2
+ import transport from "./transport.js";
3
+ import parseResponse from "./parseResponse.js";
4
+
5
+ const startFunc = async ({ inEndpoint, inParam }) => {
6
+ const localEndpoint = inEndpoint;
7
+ const localParam = inParam;
8
+
9
+ const xml = buildXml({
10
+ inEndpoint: localEndpoint,
11
+ inParam: localParam
12
+ });
13
+
14
+ const rawResponse = await transport({
15
+ inXml: xml
16
+ });
17
+
18
+ const parsedJson = parseResponse({
19
+ inXml: rawResponse
20
+ });
21
+
22
+ return parsedJson;
23
+ };
24
+
25
+ export default startFunc;
@@ -1,13 +1,13 @@
1
- import { XMLParser } from "fast-xml-parser";
2
-
3
- const startFunc = ({ inXml }) => {
4
- const localXml = inXml;
5
-
6
- const parser = new XMLParser({
7
- ignoreAttributes: false
8
- });
9
-
10
- return parser.parse(localXml);
11
- };
12
-
13
- export default startFunc;
1
+ import { XMLParser } from "fast-xml-parser";
2
+
3
+ const startFunc = ({ inXml }) => {
4
+ const localXml = inXml;
5
+
6
+ const parser = new XMLParser({
7
+ ignoreAttributes: false
8
+ });
9
+
10
+ return parser.parse(localXml);
11
+ };
12
+
13
+ export default startFunc;
@@ -1,16 +1,16 @@
1
- const startFunc = async ({ inXml }) => {
2
- const localXml = inXml;
3
- const localUrl = "http://localhost:9000";
4
-
5
- const response = await fetch(localUrl, {
6
- method: "POST",
7
- headers: {
8
- "Content-Type": "text/xml"
9
- },
10
- body: localXml
11
- });
12
-
13
- return await response.text();
14
- };
15
-
16
- export default startFunc;
1
+ const startFunc = async ({ inXml }) => {
2
+ const localXml = inXml;
3
+ const localUrl = "http://localhost:9000";
4
+
5
+ const response = await fetch(localUrl, {
6
+ method: "POST",
7
+ headers: {
8
+ "Content-Type": "text/xml"
9
+ },
10
+ body: localXml
11
+ });
12
+
13
+ return await response.text();
14
+ };
15
+
16
+ export default startFunc;
@@ -1,12 +1,12 @@
1
- const startFunc = ({ inSource, inRoutePath }) => {
2
- const localSource = inSource;
3
- const localRoutePath = inRoutePath;
4
-
5
- const endpoint = localRoutePath
6
- .split(".")
7
- .reduce((current, key) => current?.[key], localSource);
8
-
9
- return endpoint;
10
- };
11
-
12
- export default startFunc;
1
+ const startFunc = ({ inSource, inRoutePath }) => {
2
+ const localSource = inSource;
3
+ const localRoutePath = inRoutePath;
4
+
5
+ const endpoint = localRoutePath
6
+ .split(".")
7
+ .reduce((current, key) => current?.[key], localSource);
8
+
9
+ return endpoint;
10
+ };
11
+
12
+ export default startFunc;
@@ -1,25 +1,25 @@
1
- import validateInput from "./validateInput/index.js";
2
- import getEndpointSpec from "./getEndpointSpec/index.js";
3
- import dispatchTally from "./dispatchTally/index.js";
4
-
5
- const startFunc = async ({ inRoutePath, inParam, inSource }) => {
6
- const localRoutePath = inRoutePath;
7
- const localParam = inParam;
8
- const localSource = inSource;
9
-
10
- const param = validateInput({
11
- inParam: localParam
12
- });
13
-
14
- const endpoint = getEndpointSpec({
15
- inSource: localSource,
16
- inRoutePath: localRoutePath
17
- });
18
-
19
- return await dispatchTally({
20
- inEndpoint: endpoint,
21
- inParam: param
22
- });
23
- };
24
-
1
+ import validateInput from "./validateInput/index.js";
2
+ import getEndpointSpec from "./getEndpointSpec/index.js";
3
+ import dispatchTally from "./dispatchTally/index.js";
4
+
5
+ const startFunc = async ({ inRoutePath, inParam, inSource }) => {
6
+ const localRoutePath = inRoutePath;
7
+ const localParam = inParam;
8
+ const localSource = inSource;
9
+
10
+ const param = validateInput({
11
+ inParam: localParam
12
+ });
13
+
14
+ const endpoint = getEndpointSpec({
15
+ inSource: localSource,
16
+ inRoutePath: localRoutePath
17
+ });
18
+
19
+ return await dispatchTally({
20
+ inEndpoint: endpoint,
21
+ inParam: param
22
+ });
23
+ };
24
+
25
25
  export default startFunc;
@@ -1,19 +1,19 @@
1
- const startFunc = ({ inParam }) => {
2
- const localParam = inParam;
3
-
4
- if (localParam === undefined || localParam === null) {
5
- return "";
6
- }
7
-
8
- if (typeof localParam === "string") {
9
- return localParam.trim();
10
- }
11
-
12
- if (typeof localParam === "object") {
13
- return localParam;
14
- }
15
-
16
- return String(localParam);
17
- };
18
-
19
- export default startFunc;
1
+ const startFunc = ({ inParam }) => {
2
+ const localParam = inParam;
3
+
4
+ if (localParam === undefined || localParam === null) {
5
+ return "";
6
+ }
7
+
8
+ if (typeof localParam === "string") {
9
+ return localParam.trim();
10
+ }
11
+
12
+ if (typeof localParam === "object") {
13
+ return localParam;
14
+ }
15
+
16
+ return String(localParam);
17
+ };
18
+
19
+ export default startFunc;
package/src/v25/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import apiTree from "@keshavsoft/api-tree";
2
- import { source, apiPaths } from "tally-spec";
3
-
4
- import execute from "./engine/index.js";
5
-
6
- const app = apiTree(source, apiPaths, execute);
7
-
8
- export default app;
1
+ import apiTree from "@keshavsoft/api-tree";
2
+ import { source, apiPaths } from "tally-spec";
3
+
4
+ import execute from "./engine/index.js";
5
+
6
+ const app = apiTree(source, apiPaths, execute);
7
+
8
+ export default app;