tally-simple 1.1.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/CHANGELOG.md +8 -8
- package/LICENSE +21 -21
- package/README.md +176 -70
- package/bin/tally-simple.js +170 -175
- package/docs/.nojekyll +1 -0
- package/docs/architecture.html +73 -0
- package/docs/architecture.md +82 -43
- package/docs/execution-pipeline.html +71 -0
- package/docs/execution-pipeline.md +158 -0
- package/docs/index.html +294 -0
- package/docs/queries.html +107 -0
- package/docs/queries.md +122 -0
- package/docs/route-engine.html +57 -0
- package/docs/route-engine.md +141 -0
- package/docs/style.css +137 -0
- package/docs/usage.html +82 -0
- package/docs/usage.md +117 -73
- package/package.json +61 -47
- package/src/index.js +2 -8
- package/src/v5/external-api/api.js +21 -0
- package/src/v5/external-api/api.json +6 -0
- package/src/v5/index.js +1 -0
- package/src/v5/internal-working/execution/buildXmlBody.js +41 -0
- package/src/v5/internal-working/execution/getTdl.js +12 -0
- package/src/v5/internal-working/execution/index.js +30 -0
- package/src/v5/internal-working/execution/postHttp.js +26 -0
- package/src/v5/internal-working/execution/validateCompany.js +11 -0
- package/src/v5/internal-working/route/attachPath.js +25 -0
- package/src/v5/internal-working/route/createLeafHandler.js +17 -0
- package/src/v5/internal-working/route/index.js +24 -0
- package/src/{v1 → v5}/source.json +38 -40
- package/src/v6/external-api/api.js +21 -0
- package/src/v6/external-api/api.json +6 -0
- package/src/v6/index.js +1 -0
- package/src/v6/internal-working/execution/buildXmlBody.js +41 -0
- package/src/v6/internal-working/execution/getTdl.js +12 -0
- package/src/v6/internal-working/execution/index.js +30 -0
- package/src/v6/internal-working/execution/postHttp.js +26 -0
- package/src/v6/internal-working/execution/validateCompany.js +11 -0
- package/src/v6/internal-working/route/attachPath.js +25 -0
- package/src/v6/internal-working/route/createLeafHandler.js +17 -0
- package/src/v6/internal-working/route/index.js +24 -0
- package/src/v6/source.json +38 -0
- package/src/v7/api.json +6 -0
- package/src/v7/index.js +14 -0
- package/src/v7/internal-working/execution/buildXmlBody.js +41 -0
- package/src/v7/internal-working/execution/getTdl.js +12 -0
- package/src/v7/internal-working/execution/index.js +30 -0
- package/src/v7/internal-working/execution/postHttp.js +26 -0
- package/src/v7/internal-working/execution/validateCompany.js +11 -0
- package/src/v7/internal-working/route/attachPath.js +25 -0
- package/src/v7/internal-working/route/createLeafHandler.js +17 -0
- package/src/v7/internal-working/route/index.js +24 -0
- package/src/v7/source.json +38 -0
- package/src/v8/engine/index.js +18 -0
- package/src/v8/engine/parseXml.js +11 -0
- package/src/v8/index.js +21 -0
- package/docs/api.md +0 -19
- package/docs/cli.md +0 -32
- package/docs/development.md +0 -66
- package/src/index.d.ts +0 -36
- package/src/v1/external-api/api.js +0 -67
- package/src/v1/external-api/api.json +0 -5
- package/src/v1/external-api/index.js +0 -1
- package/src/v1/index.js +0 -1
- package/src/v1/traverse.js +0 -103
- package/src/v1/traverseObject/index.js +0 -39
package/docs/index.html
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Tally Simple — Documentation Hub</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--bg: #0f172a;
|
|
10
|
+
--card-bg: #1e293b;
|
|
11
|
+
--card-border: #334155;
|
|
12
|
+
--text-main: #f8fafc;
|
|
13
|
+
--text-muted: #94a3b8;
|
|
14
|
+
--accent: #38bdf8;
|
|
15
|
+
--accent-hover: #7dd3fc;
|
|
16
|
+
--success: #34d399;
|
|
17
|
+
}
|
|
18
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
19
|
+
body {
|
|
20
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
21
|
+
background-color: var(--bg);
|
|
22
|
+
color: var(--text-main);
|
|
23
|
+
line-height: 1.6;
|
|
24
|
+
padding: 2.5rem 1.5rem;
|
|
25
|
+
}
|
|
26
|
+
.container {
|
|
27
|
+
max-width: 920px;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
}
|
|
30
|
+
header {
|
|
31
|
+
margin-bottom: 2.5rem;
|
|
32
|
+
border-bottom: 1px solid var(--card-border);
|
|
33
|
+
padding-bottom: 1.5rem;
|
|
34
|
+
}
|
|
35
|
+
.badge-row {
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 0.5rem;
|
|
38
|
+
margin-bottom: 0.75rem;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
}
|
|
41
|
+
.badge {
|
|
42
|
+
font-size: 0.75rem;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
padding: 0.2rem 0.55rem;
|
|
45
|
+
border-radius: 9999px;
|
|
46
|
+
background: rgba(56, 189, 248, 0.12);
|
|
47
|
+
color: var(--accent);
|
|
48
|
+
border: 1px solid rgba(56, 189, 248, 0.25);
|
|
49
|
+
text-transform: uppercase;
|
|
50
|
+
letter-spacing: 0.05em;
|
|
51
|
+
}
|
|
52
|
+
.badge-green {
|
|
53
|
+
background: rgba(52, 211, 153, 0.12);
|
|
54
|
+
color: var(--success);
|
|
55
|
+
border-color: rgba(52, 211, 153, 0.25);
|
|
56
|
+
}
|
|
57
|
+
h1 {
|
|
58
|
+
font-size: 2.3rem;
|
|
59
|
+
font-weight: 800;
|
|
60
|
+
color: var(--text-main);
|
|
61
|
+
margin-bottom: 0.5rem;
|
|
62
|
+
letter-spacing: -0.02em;
|
|
63
|
+
}
|
|
64
|
+
.subtitle {
|
|
65
|
+
font-size: 1.15rem;
|
|
66
|
+
color: var(--text-muted);
|
|
67
|
+
}
|
|
68
|
+
.story-hero {
|
|
69
|
+
background: var(--card-bg);
|
|
70
|
+
border: 1px solid var(--card-border);
|
|
71
|
+
border-radius: 10px;
|
|
72
|
+
padding: 1.75rem;
|
|
73
|
+
margin-bottom: 2.5rem;
|
|
74
|
+
position: relative;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
.story-hero::before {
|
|
78
|
+
content: "";
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
width: 4px;
|
|
83
|
+
height: 100%;
|
|
84
|
+
background: var(--accent);
|
|
85
|
+
}
|
|
86
|
+
.story-hero h2 {
|
|
87
|
+
font-size: 1.35rem;
|
|
88
|
+
color: var(--accent);
|
|
89
|
+
margin-bottom: 0.5rem;
|
|
90
|
+
}
|
|
91
|
+
.story-hero p {
|
|
92
|
+
color: var(--text-muted);
|
|
93
|
+
font-size: 1rem;
|
|
94
|
+
margin-bottom: 1rem;
|
|
95
|
+
}
|
|
96
|
+
.story-flow {
|
|
97
|
+
background: rgba(15, 23, 42, 0.7);
|
|
98
|
+
border: 1px solid var(--card-border);
|
|
99
|
+
border-radius: 6px;
|
|
100
|
+
padding: 1rem;
|
|
101
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
102
|
+
font-size: 0.88rem;
|
|
103
|
+
color: #38bdf8;
|
|
104
|
+
margin: 1rem 0;
|
|
105
|
+
overflow-x: auto;
|
|
106
|
+
}
|
|
107
|
+
.pipeline-diagram {
|
|
108
|
+
display: grid;
|
|
109
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
110
|
+
gap: 1rem;
|
|
111
|
+
margin-top: 1.25rem;
|
|
112
|
+
}
|
|
113
|
+
.pipeline-step {
|
|
114
|
+
background: rgba(15, 23, 42, 0.5);
|
|
115
|
+
border: 1px solid var(--card-border);
|
|
116
|
+
border-radius: 6px;
|
|
117
|
+
padding: 0.85rem;
|
|
118
|
+
}
|
|
119
|
+
.pipeline-step .step-num {
|
|
120
|
+
font-size: 0.75rem;
|
|
121
|
+
font-weight: 700;
|
|
122
|
+
color: var(--accent);
|
|
123
|
+
margin-bottom: 0.2rem;
|
|
124
|
+
}
|
|
125
|
+
.pipeline-step h3 {
|
|
126
|
+
font-size: 0.95rem;
|
|
127
|
+
margin-bottom: 0.35rem;
|
|
128
|
+
color: var(--text-main);
|
|
129
|
+
}
|
|
130
|
+
.pipeline-step p {
|
|
131
|
+
font-size: 0.82rem;
|
|
132
|
+
color: var(--text-muted);
|
|
133
|
+
margin-bottom: 0;
|
|
134
|
+
}
|
|
135
|
+
.grid {
|
|
136
|
+
display: grid;
|
|
137
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
138
|
+
gap: 1.5rem;
|
|
139
|
+
}
|
|
140
|
+
.card {
|
|
141
|
+
background-color: var(--card-bg);
|
|
142
|
+
border: 1px solid var(--card-border);
|
|
143
|
+
border-radius: 8px;
|
|
144
|
+
padding: 1.5rem;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
justify-content: space-between;
|
|
148
|
+
transition: border-color 0.2s, transform 0.2s;
|
|
149
|
+
text-decoration: none;
|
|
150
|
+
color: inherit;
|
|
151
|
+
}
|
|
152
|
+
.card:hover {
|
|
153
|
+
border-color: var(--accent);
|
|
154
|
+
transform: translateY(-2px);
|
|
155
|
+
}
|
|
156
|
+
.card h2 {
|
|
157
|
+
font-size: 1.25rem;
|
|
158
|
+
color: var(--accent);
|
|
159
|
+
margin-bottom: 0.5rem;
|
|
160
|
+
}
|
|
161
|
+
.card p {
|
|
162
|
+
color: var(--text-muted);
|
|
163
|
+
font-size: 0.93rem;
|
|
164
|
+
margin-bottom: 1rem;
|
|
165
|
+
}
|
|
166
|
+
.formats {
|
|
167
|
+
display: flex;
|
|
168
|
+
gap: 0.75rem;
|
|
169
|
+
font-size: 0.85rem;
|
|
170
|
+
}
|
|
171
|
+
.format-badge {
|
|
172
|
+
background: rgba(56, 189, 248, 0.1);
|
|
173
|
+
color: var(--accent);
|
|
174
|
+
padding: 0.2rem 0.5rem;
|
|
175
|
+
border-radius: 4px;
|
|
176
|
+
font-weight: 600;
|
|
177
|
+
}
|
|
178
|
+
footer {
|
|
179
|
+
margin-top: 3.5rem;
|
|
180
|
+
text-align: center;
|
|
181
|
+
color: var(--text-muted);
|
|
182
|
+
font-size: 0.9rem;
|
|
183
|
+
border-top: 1px solid var(--card-border);
|
|
184
|
+
padding-top: 1.5rem;
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
187
|
+
</head>
|
|
188
|
+
<body>
|
|
189
|
+
<div class="container">
|
|
190
|
+
<header>
|
|
191
|
+
<div class="badge-row">
|
|
192
|
+
<span class="badge">v1.7.2</span>
|
|
193
|
+
<span class="badge badge-green">Zero Dependencies</span>
|
|
194
|
+
<span class="badge">Node.js >= 20.10</span>
|
|
195
|
+
<span class="badge">Raw XML Transport</span>
|
|
196
|
+
</div>
|
|
197
|
+
<h1>Tally Simple Documentation Hub</h1>
|
|
198
|
+
<p class="subtitle">A small, typed JavaScript client and CLI for querying Tally via TDL definitions.</p>
|
|
199
|
+
</header>
|
|
200
|
+
|
|
201
|
+
<section class="story-hero">
|
|
202
|
+
<h2>The Story of Tally Simple</h2>
|
|
203
|
+
<p>Querying Tally ERP / Prime directly over HTTP (port 9000) requires complex XML request wrappers and obscure TDL syntax. <code>tally-simple</code> acts as the pure transport engine: choose an endpoint, supply a company name, and receive Tally's exact, raw XML response.</p>
|
|
204
|
+
<p>Following the UNIX philosophy, responses are kept as raw XML text—making them 100% loss-free, directly pipeable into shell files (<code>> units.xml</code>), and ideal for downstream transformation layers like <code>tally-simple-json</code>.</p>
|
|
205
|
+
|
|
206
|
+
<div class="story-flow">Your App / Shell ───► tally-simple ───► Tally (:9000) ───► Raw XML Response String</div>
|
|
207
|
+
|
|
208
|
+
<div class="pipeline-diagram">
|
|
209
|
+
<div class="pipeline-step">
|
|
210
|
+
<div class="step-num">STEP 1</div>
|
|
211
|
+
<h3>Validate Company</h3>
|
|
212
|
+
<p>Ensures company name is a non-empty string and trims whitespace.</p>
|
|
213
|
+
</div>
|
|
214
|
+
<div class="pipeline-step">
|
|
215
|
+
<div class="step-num">STEP 2</div>
|
|
216
|
+
<h3>Get TDL Query</h3>
|
|
217
|
+
<p>O(1) path reduction lookup into <code>source.json</code> to retrieve TDL.</p>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="pipeline-step">
|
|
220
|
+
<div class="step-num">STEP 3</div>
|
|
221
|
+
<h3>Build XML Body</h3>
|
|
222
|
+
<p>Escapes XML entities and injects into Tally request envelope.</p>
|
|
223
|
+
</div>
|
|
224
|
+
<div class="pipeline-step">
|
|
225
|
+
<div class="step-num">STEP 4</div>
|
|
226
|
+
<h3>Post HTTP</h3>
|
|
227
|
+
<p>POST to <code>localhost:9000</code> and returns raw response body.</p>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</section>
|
|
231
|
+
|
|
232
|
+
<div class="grid">
|
|
233
|
+
<a class="card" href="usage.html">
|
|
234
|
+
<div>
|
|
235
|
+
<h2>1. Usage Guide</h2>
|
|
236
|
+
<p>How to consume Tally Simple via ESM JavaScript, TypeScript typings, and the command line interface.</p>
|
|
237
|
+
</div>
|
|
238
|
+
<div class="formats">
|
|
239
|
+
<span class="format-badge">HTML</span>
|
|
240
|
+
<span class="format-badge" onclick="event.preventDefault(); window.location.href='usage.md';">Markdown</span>
|
|
241
|
+
</div>
|
|
242
|
+
</a>
|
|
243
|
+
|
|
244
|
+
<a class="card" href="queries.html">
|
|
245
|
+
<div>
|
|
246
|
+
<h2>2. Available Queries</h2>
|
|
247
|
+
<p>Complete directory of supported master endpoints, requested TDL collections, and raw XML returns.</p>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="formats">
|
|
250
|
+
<span class="format-badge">HTML</span>
|
|
251
|
+
<span class="format-badge" onclick="event.preventDefault(); window.location.href='queries.md';">Markdown</span>
|
|
252
|
+
</div>
|
|
253
|
+
</a>
|
|
254
|
+
|
|
255
|
+
<a class="card" href="architecture.html">
|
|
256
|
+
<div>
|
|
257
|
+
<h2>3. System Architecture</h2>
|
|
258
|
+
<p>Clean boundaries between public allowlists, domain-only specifications, and the internal engines.</p>
|
|
259
|
+
</div>
|
|
260
|
+
<div class="formats">
|
|
261
|
+
<span class="format-badge">HTML</span>
|
|
262
|
+
<span class="format-badge" onclick="event.preventDefault(); window.location.href='architecture.md';">Markdown</span>
|
|
263
|
+
</div>
|
|
264
|
+
</a>
|
|
265
|
+
|
|
266
|
+
<a class="card" href="route-engine.html">
|
|
267
|
+
<div>
|
|
268
|
+
<h2>4. Route Engine</h2>
|
|
269
|
+
<p>How the nested, callable object tree is assembled from allowlisted dot-paths without hardcoding.</p>
|
|
270
|
+
</div>
|
|
271
|
+
<div class="formats">
|
|
272
|
+
<span class="format-badge">HTML</span>
|
|
273
|
+
<span class="format-badge" onclick="event.preventDefault(); window.location.href='route-engine.md';">Markdown</span>
|
|
274
|
+
</div>
|
|
275
|
+
</a>
|
|
276
|
+
|
|
277
|
+
<a class="card" href="execution-pipeline.html">
|
|
278
|
+
<div>
|
|
279
|
+
<h2>5. Execution Pipeline</h2>
|
|
280
|
+
<p>The 4-step story: company validation, O(1) TDL lookup, XML body building, and HTTP dispatch.</p>
|
|
281
|
+
</div>
|
|
282
|
+
<div class="formats">
|
|
283
|
+
<span class="format-badge">HTML</span>
|
|
284
|
+
<span class="format-badge" onclick="event.preventDefault(); window.location.href='execution-pipeline.md';">Markdown</span>
|
|
285
|
+
</div>
|
|
286
|
+
</a>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<footer>
|
|
290
|
+
<p>© KeshavSoft. Distributed under the MIT License.</p>
|
|
291
|
+
</footer>
|
|
292
|
+
</div>
|
|
293
|
+
</body>
|
|
294
|
+
</html>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Available Queries — Tally Simple</title>
|
|
7
|
+
<link rel="stylesheet" href="style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<nav class="doc-nav">
|
|
12
|
+
<a href="index.html">← Documentation Hub</a>
|
|
13
|
+
<a href="queries.md">View Markdown</a>
|
|
14
|
+
</nav>
|
|
15
|
+
|
|
16
|
+
<h1>Available Queries Reference</h1>
|
|
17
|
+
<p>This document details the queries available in Tally Simple, the underlying TDL requests generated, and the XML data returned.</p>
|
|
18
|
+
|
|
19
|
+
<h2>Master Endpoints Overview</h2>
|
|
20
|
+
<table>
|
|
21
|
+
<thead>
|
|
22
|
+
<tr>
|
|
23
|
+
<th>Query Path</th>
|
|
24
|
+
<th>Domain Object</th>
|
|
25
|
+
<th>TDL Action</th>
|
|
26
|
+
</tr>
|
|
27
|
+
</thead>
|
|
28
|
+
<tbody>
|
|
29
|
+
<tr>
|
|
30
|
+
<td><code>tally.masters.units.fetch</code></td>
|
|
31
|
+
<td>Unit of Measurement</td>
|
|
32
|
+
<td><code>fetch</code></td>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr>
|
|
35
|
+
<td><code>tally.masters.stockItems.withBatches</code></td>
|
|
36
|
+
<td>Inventory Stock Item</td>
|
|
37
|
+
<td><code>fetch</code></td>
|
|
38
|
+
</tr>
|
|
39
|
+
<tr>
|
|
40
|
+
<td><code>tally.masters.ledgers.withGstDetails</code></td>
|
|
41
|
+
<td>Accounting Ledger</td>
|
|
42
|
+
<td><code>fetch</code></td>
|
|
43
|
+
</tr>
|
|
44
|
+
<tr>
|
|
45
|
+
<td><code>tally.masters.stockGroup.withParent</code></td>
|
|
46
|
+
<td>Stock Classification</td>
|
|
47
|
+
<td><code>fetch</code></td>
|
|
48
|
+
</tr>
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
51
|
+
|
|
52
|
+
<h2>1. Units (<code>masters.units.fetch</code>)</h2>
|
|
53
|
+
<p>Fetches all defined units of measurement in the specified company along with their aliases and names.</p>
|
|
54
|
+
<pre><code><TYPE>Unit</TYPE>
|
|
55
|
+
<FETCH>$$Alias:Name</FETCH></code></pre>
|
|
56
|
+
|
|
57
|
+
<h2>2. Stock Items with Batches (<code>masters.stockItems.withBatches</code>)</h2>
|
|
58
|
+
<p>Fetches stock items including their base unit of measure and batch allocation details.</p>
|
|
59
|
+
<pre><code><TYPE>StockItem</TYPE>
|
|
60
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
61
|
+
<FETCH>BaseUnits</FETCH>
|
|
62
|
+
<FETCH>BatchAllocations.*</FETCH></code></pre>
|
|
63
|
+
|
|
64
|
+
<h2>3. Ledgers with GST Details (<code>masters.ledgers.withGstDetails</code>)</h2>
|
|
65
|
+
<p>Fetches accounting ledgers including their GST registration details list.</p>
|
|
66
|
+
<pre><code><TYPE>Ledger</TYPE>
|
|
67
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
68
|
+
<FETCH>LEDGSTREGDETAILS.LIST</FETCH></code></pre>
|
|
69
|
+
|
|
70
|
+
<h2>4. Stock Groups with Parent (<code>masters.stockGroup.withParent</code>)</h2>
|
|
71
|
+
<p>Fetches stock groups and their parent group hierarchy.</p>
|
|
72
|
+
<pre><code><TYPE>StockGroup</TYPE>
|
|
73
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
74
|
+
<FETCH>Parent</FETCH></code></pre>
|
|
75
|
+
|
|
76
|
+
<h2>The Request Envelope</h2>
|
|
77
|
+
<p>Tally Simple dynamically injects the company name and TDL collection into Tally's standard Export Collection envelope:</p>
|
|
78
|
+
<pre><code><ENVELOPE>
|
|
79
|
+
<HEADER>
|
|
80
|
+
<VERSION>1</VERSION>
|
|
81
|
+
<TALLYREQUEST>Export</TALLYREQUEST>
|
|
82
|
+
<TYPE>Collection</TYPE>
|
|
83
|
+
<ID>TDLID</ID>
|
|
84
|
+
</HEADER>
|
|
85
|
+
<BODY>
|
|
86
|
+
<DESC>
|
|
87
|
+
<STATICVARIABLES>
|
|
88
|
+
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
|
|
89
|
+
<SVCURRENTCOMPANY>{company}</SVCURRENTCOMPANY>
|
|
90
|
+
</STATICVARIABLES>
|
|
91
|
+
<TDL>
|
|
92
|
+
<TDLMESSAGE>
|
|
93
|
+
<COLLECTION NAME="TDLID">
|
|
94
|
+
{collectionBody}
|
|
95
|
+
</COLLECTION>
|
|
96
|
+
</TDLMESSAGE>
|
|
97
|
+
</TDL>
|
|
98
|
+
</DESC>
|
|
99
|
+
</BODY>
|
|
100
|
+
</ENVELOPE></code></pre>
|
|
101
|
+
|
|
102
|
+
<footer>
|
|
103
|
+
<p>© KeshavSoft. Distributed under the MIT License.</p>
|
|
104
|
+
</footer>
|
|
105
|
+
</div>
|
|
106
|
+
</body>
|
|
107
|
+
</html>
|
package/docs/queries.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Available Queries Reference
|
|
2
|
+
|
|
3
|
+
[**View this document as HTML**](./queries.html) · [**Documentation Hub**](./index.html)
|
|
4
|
+
|
|
5
|
+
This document details the queries available in Tally Simple, the underlying TDL requests generated, and the XML data returned.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Master Endpoints Overview
|
|
10
|
+
|
|
11
|
+
| Query Path | Domain Object | TDL Action |
|
|
12
|
+
| :--- | :--- | :--- |
|
|
13
|
+
| `tally.masters.units.fetch` | Unit of Measurement | `fetch` |
|
|
14
|
+
| `tally.masters.stockItems.withBatches` | Inventory Stock Item | `fetch` |
|
|
15
|
+
| `tally.masters.ledgers.withGstDetails` | Accounting Ledger | `fetch` |
|
|
16
|
+
| `tally.masters.stockGroup.withParent` | Stock Classification | `fetch` |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Units (`masters.units.fetch`)
|
|
21
|
+
|
|
22
|
+
Fetches all defined units of measurement in the specified company along with their aliases and names.
|
|
23
|
+
|
|
24
|
+
### TDL Definition:
|
|
25
|
+
```xml
|
|
26
|
+
<TYPE>Unit</TYPE>
|
|
27
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Usage:
|
|
31
|
+
```javascript
|
|
32
|
+
const xml = await tally.masters.units.fetch("Mani9");
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Stock Items with Batches (`masters.stockItems.withBatches`)
|
|
38
|
+
|
|
39
|
+
Fetches stock items including their base unit of measure and batch allocation details.
|
|
40
|
+
|
|
41
|
+
### TDL Definition:
|
|
42
|
+
```xml
|
|
43
|
+
<TYPE>StockItem</TYPE>
|
|
44
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
45
|
+
<FETCH>BaseUnits</FETCH>
|
|
46
|
+
<FETCH>BatchAllocations.*</FETCH>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Usage:
|
|
50
|
+
```javascript
|
|
51
|
+
const xml = await tally.masters.stockItems.withBatches("Mani9");
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. Ledgers with GST Details (`masters.ledgers.withGstDetails`)
|
|
57
|
+
|
|
58
|
+
Fetches accounting ledgers including their GST registration details list.
|
|
59
|
+
|
|
60
|
+
### TDL Definition:
|
|
61
|
+
```xml
|
|
62
|
+
<TYPE>Ledger</TYPE>
|
|
63
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
64
|
+
<FETCH>LEDGSTREGDETAILS.LIST</FETCH>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Usage:
|
|
68
|
+
```javascript
|
|
69
|
+
const xml = await tally.masters.ledgers.withGstDetails("Mani9");
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 4. Stock Groups with Parent (`masters.stockGroup.withParent`)
|
|
75
|
+
|
|
76
|
+
Fetches stock groups and their parent group hierarchy.
|
|
77
|
+
|
|
78
|
+
### TDL Definition:
|
|
79
|
+
```xml
|
|
80
|
+
<TYPE>StockGroup</TYPE>
|
|
81
|
+
<FETCH>$$Alias:Name</FETCH>
|
|
82
|
+
<FETCH>Parent</FETCH>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Usage:
|
|
86
|
+
```javascript
|
|
87
|
+
const xml = await tally.masters.stockGroup.withParent("Mani9");
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## The Request Envelope
|
|
93
|
+
|
|
94
|
+
Every query is wrapped inside Tally's standard Export Collection XML envelope:
|
|
95
|
+
|
|
96
|
+
```xml
|
|
97
|
+
<ENVELOPE>
|
|
98
|
+
<HEADER>
|
|
99
|
+
<VERSION>1</VERSION>
|
|
100
|
+
<TALLYREQUEST>Export</TALLYREQUEST>
|
|
101
|
+
<TYPE>Collection</TYPE>
|
|
102
|
+
<ID>TDLID</ID>
|
|
103
|
+
</HEADER>
|
|
104
|
+
<BODY>
|
|
105
|
+
<DESC>
|
|
106
|
+
<STATICVARIABLES>
|
|
107
|
+
<SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
|
|
108
|
+
<SVCURRENTCOMPANY>{company}</SVCURRENTCOMPANY>
|
|
109
|
+
</STATICVARIABLES>
|
|
110
|
+
<TDL>
|
|
111
|
+
<TDLMESSAGE>
|
|
112
|
+
<COLLECTION NAME="TDLID">
|
|
113
|
+
{collectionBody}
|
|
114
|
+
</COLLECTION>
|
|
115
|
+
</TDLMESSAGE>
|
|
116
|
+
</TDL>
|
|
117
|
+
</DESC>
|
|
118
|
+
</BODY>
|
|
119
|
+
</ENVELOPE>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Tally Simple dynamically substitutes `{company}` (XML-escaped) and `{collectionBody}` (the TDL collection query) at runtime.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Route Assembly Engine — Tally Simple</title>
|
|
7
|
+
<link rel="stylesheet" href="style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<nav class="doc-nav">
|
|
12
|
+
<a href="index.html">← Documentation Hub</a>
|
|
13
|
+
<a href="route-engine.md">View Markdown</a>
|
|
14
|
+
</nav>
|
|
15
|
+
|
|
16
|
+
<h1>Route Assembly Engine</h1>
|
|
17
|
+
<p>The route engine transforms a flat allowlist of string paths (from <code>api.json</code>) into an intuitive, nested, callable JavaScript object tree at initialization.</p>
|
|
18
|
+
|
|
19
|
+
<h2>Why Route Assembly?</h2>
|
|
20
|
+
<p>Consumers expect to call:</p>
|
|
21
|
+
<pre><code>await tally.masters.units.fetch("Mani9");</code></pre>
|
|
22
|
+
<p>The route engine builds this tree dynamically from <code>api.json</code> without hardcoding methods.</p>
|
|
23
|
+
|
|
24
|
+
<h2>The Three Narrative Modules</h2>
|
|
25
|
+
<p>Inside <code>internal-working/route/</code>, the responsibility is divided into three small, story-driven files:</p>
|
|
26
|
+
<pre><code>internal-working/route/
|
|
27
|
+
├── index.js <-- Coordinator: iterates paths & returns root
|
|
28
|
+
├── attachPath.js <-- Walks tree branches & mounts leaf
|
|
29
|
+
└── createLeafHandler.js <-- Factory creating the callable endpoint</code></pre>
|
|
30
|
+
|
|
31
|
+
<h2>1. The Leaf Factory (<code>createLeafHandler.js</code>)</h2>
|
|
32
|
+
<p>A leaf is the terminal callable function at the end of a route. When the user executes <code>fetch("Mani9")</code>, the leaf handler captures the bound route path and delegates execution to the executor.</p>
|
|
33
|
+
|
|
34
|
+
<h2>2. Path Attacher (<code>attachPath.js</code>)</h2>
|
|
35
|
+
<p>To attach a path like <code>"tally.masters.units.fetch"</code>:</p>
|
|
36
|
+
<ol>
|
|
37
|
+
<li>Split the path into branch segments (<code>["tally", "masters", "units"]</code>) and a leaf name (<code>"fetch"</code>).</li>
|
|
38
|
+
<li>Walk through the branch segments, creating intermediate objects if they don't yet exist.</li>
|
|
39
|
+
<li>Attach the callable leaf handler at the target position.</li>
|
|
40
|
+
</ol>
|
|
41
|
+
|
|
42
|
+
<h2>3. Route Coordinator (<code>index.js</code>)</h2>
|
|
43
|
+
<p>The entry coordinator iterates each path in <code>inApiPaths</code>, mounts it into the tree using <code>attachPath</code>, and returns the root namespace.</p>
|
|
44
|
+
|
|
45
|
+
<h2>Benefits of this Design</h2>
|
|
46
|
+
<ul>
|
|
47
|
+
<li><strong>Predictable:</strong> Built once at module load time. Zero runtime overhead during queries.</li>
|
|
48
|
+
<li><strong>Narrative-Driven:</strong> Every file is under 40 lines and has a single, obvious purpose.</li>
|
|
49
|
+
<li><strong>Strictly One Export:</strong> Every file uses <code>export default startFunc;</code>.</li>
|
|
50
|
+
</ul>
|
|
51
|
+
|
|
52
|
+
<footer>
|
|
53
|
+
<p>© KeshavSoft. Distributed under the MIT License.</p>
|
|
54
|
+
</footer>
|
|
55
|
+
</div>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|