tally-simple 1.1.1 → 1.3.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/CHANGELOG.md +8 -8
- package/LICENSE +21 -21
- package/README.md +127 -70
- package/bin/tally-simple.js +175 -175
- package/docs/api.html +41 -0
- package/docs/api.md +20 -19
- package/docs/architecture.html +74 -0
- package/docs/architecture.md +65 -43
- package/docs/developer.html +57 -0
- package/docs/developer.md +41 -0
- package/docs/end-user.html +49 -0
- package/docs/end-user.md +34 -0
- package/docs/index.html +32 -0
- package/docs/repo-developer.html +91 -0
- package/docs/repo-developer.md +107 -0
- package/package.json +55 -47
- package/src/index.d.ts +20 -2
- package/src/index.js +8 -8
- package/src/v1/external-api/api.js +67 -67
- package/src/v1/external-api/api.json +4 -4
- package/src/v1/external-api/index.js +1 -1
- package/src/v1/index.js +1 -1
- package/src/v1/source.json +40 -40
- package/src/v1/traverse.js +103 -103
- package/src/v1/traverseObject/index.js +39 -39
- package/src/v2/external-api/api.js +67 -0
- package/src/v2/external-api/api.json +5 -0
- package/src/v2/external-api/index.js +1 -0
- package/src/v2/index.js +1 -0
- package/src/v2/source.json +40 -0
- package/src/v2/traverse.js +103 -0
- package/src/v2/traverseObject/index.js +39 -0
- package/src/v3/external-api/api.js +67 -0
- package/src/v3/external-api/api.json +6 -0
- package/src/v3/external-api/index.js +1 -0
- package/src/v3/index.js +1 -0
- package/src/v3/source.json +48 -0
- package/src/v3/traverse.js +103 -0
- package/src/v3/traverseObject/index.js +39 -0
- package/docs/cli.md +0 -32
- package/docs/development.md +0 -66
- package/docs/usage.md +0 -73
package/docs/api.md
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
[**View this document as HTML**](./api.html)
|
|
2
|
+
|
|
3
|
+
# API Reference
|
|
4
|
+
|
|
5
|
+
The public API is generated from `src/v1/external-api/api.json`.
|
|
6
|
+
|
|
7
|
+
Current public paths:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
tally.masters.units.fetch
|
|
11
|
+
tally.masters.stockItems.withBatches
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
await tally.masters.units.fetch("Mani9");
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The exact public surface should be changed through `external-api/api.json`, followed by declaration generation.
|
|
@@ -0,0 +1,74 @@
|
|
|
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">
|
|
6
|
+
<title>Architecture</title>
|
|
7
|
+
<style>
|
|
8
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;max-width:900px;margin:40px auto;padding:0 24px;line-height:1.65;color:#202124}
|
|
9
|
+
nav{padding:12px 16px;margin-bottom:28px;background:#f5f5f5;border-radius:8px}
|
|
10
|
+
nav a{margin-right:16px;text-decoration:none}
|
|
11
|
+
h1{font-size:30px;margin-top:0}
|
|
12
|
+
h2{font-size:22px;margin-top:32px}
|
|
13
|
+
h3{font-size:18px;margin-top:24px}
|
|
14
|
+
pre{background:#f6f8fa;padding:16px;border-radius:8px;overflow:auto}
|
|
15
|
+
code{background:#f1f3f4;padding:2px 5px;border-radius:4px}
|
|
16
|
+
pre code{background:none;padding:0}
|
|
17
|
+
table{border-collapse:collapse;width:100%;margin:16px 0}
|
|
18
|
+
th,td{border:1px solid #ddd;padding:8px;text-align:left}
|
|
19
|
+
th{background:#f6f6f6}
|
|
20
|
+
a{color:#0969da}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<nav>
|
|
25
|
+
<a href="../README.html">README</a>
|
|
26
|
+
<a href="end-user.html">End User</a>
|
|
27
|
+
<a href="developer.html">Application Developer</a>
|
|
28
|
+
<a href="repo-developer.html">Repository Developer</a>
|
|
29
|
+
<a href="api.html">API</a>
|
|
30
|
+
<a href="architecture.html">Architecture</a>
|
|
31
|
+
</nav>
|
|
32
|
+
<h1>Architecture</h1>
|
|
33
|
+
<p>The package is intentionally small.</p>
|
|
34
|
+
<pre><code>Caller
|
|
35
|
+
│
|
|
36
|
+
│ public path + company
|
|
37
|
+
▼
|
|
38
|
+
external-api
|
|
39
|
+
│
|
|
40
|
+
▼
|
|
41
|
+
traversal
|
|
42
|
+
│
|
|
43
|
+
▼
|
|
44
|
+
source.json
|
|
45
|
+
│
|
|
46
|
+
▼
|
|
47
|
+
request definition
|
|
48
|
+
│
|
|
49
|
+
▼
|
|
50
|
+
Tally HTTP endpoint
|
|
51
|
+
│
|
|
52
|
+
▼
|
|
53
|
+
XML response</code></pre>
|
|
54
|
+
<h2>Two JSON roles</h2>
|
|
55
|
+
<h3><code>source.json</code></h3>
|
|
56
|
+
<p>Internal implementation definition.</p>
|
|
57
|
+
<p>It contains the information required to construct the Tally request.</p>
|
|
58
|
+
<h3><code>external-api/api.json</code></h3>
|
|
59
|
+
<p>Public contract.</p>
|
|
60
|
+
<p>It contains only the paths that should be exposed to consumers.</p>
|
|
61
|
+
<p>This prevents internal request details from becoming the public API automatically.</p>
|
|
62
|
+
<h2>Why JSON</h2>
|
|
63
|
+
<p>Adding a new Tally operation should normally be a definition change:</p>
|
|
64
|
+
<pre><code>add definition
|
|
65
|
+
→ expose path
|
|
66
|
+
→ regenerate declarations
|
|
67
|
+
→ test</code></pre>
|
|
68
|
+
<p>The execution engine remains unchanged.</p>
|
|
69
|
+
<h2>Company</h2>
|
|
70
|
+
<p>Company is runtime data supplied by the caller, not a fixed value in the public API.</p>
|
|
71
|
+
<h2>XML</h2>
|
|
72
|
+
<p>The package creates and sends Tally XML. It does not require the response to be converted to JSON as part of this layer.</p>
|
|
73
|
+
</body>
|
|
74
|
+
</html>
|
package/docs/architecture.md
CHANGED
|
@@ -1,43 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The package
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
[**View this document as HTML**](./architecture.html)
|
|
2
|
+
|
|
3
|
+
# Architecture
|
|
4
|
+
|
|
5
|
+
The package is intentionally small.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Caller
|
|
9
|
+
│
|
|
10
|
+
│ public path + company
|
|
11
|
+
▼
|
|
12
|
+
external-api
|
|
13
|
+
│
|
|
14
|
+
▼
|
|
15
|
+
traversal
|
|
16
|
+
│
|
|
17
|
+
▼
|
|
18
|
+
source.json
|
|
19
|
+
│
|
|
20
|
+
▼
|
|
21
|
+
request definition
|
|
22
|
+
│
|
|
23
|
+
▼
|
|
24
|
+
Tally HTTP endpoint
|
|
25
|
+
│
|
|
26
|
+
▼
|
|
27
|
+
XML response
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Two JSON roles
|
|
31
|
+
|
|
32
|
+
### `source.json`
|
|
33
|
+
|
|
34
|
+
Internal implementation definition.
|
|
35
|
+
|
|
36
|
+
It contains the information required to construct the Tally request.
|
|
37
|
+
|
|
38
|
+
### `external-api/api.json`
|
|
39
|
+
|
|
40
|
+
Public contract.
|
|
41
|
+
|
|
42
|
+
It contains only the paths that should be exposed to consumers.
|
|
43
|
+
|
|
44
|
+
This prevents internal request details from becoming the public API automatically.
|
|
45
|
+
|
|
46
|
+
## Why JSON
|
|
47
|
+
|
|
48
|
+
Adding a new Tally operation should normally be a definition change:
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
add definition
|
|
52
|
+
→ expose path
|
|
53
|
+
→ regenerate declarations
|
|
54
|
+
→ test
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The execution engine remains unchanged.
|
|
58
|
+
|
|
59
|
+
## Company
|
|
60
|
+
|
|
61
|
+
Company is runtime data supplied by the caller, not a fixed value in the public API.
|
|
62
|
+
|
|
63
|
+
## XML
|
|
64
|
+
|
|
65
|
+
The package creates and sends Tally XML. It does not require the response to be converted to JSON as part of this layer.
|
|
@@ -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">
|
|
6
|
+
<title>Developer</title>
|
|
7
|
+
<style>
|
|
8
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;max-width:900px;margin:40px auto;padding:0 24px;line-height:1.65;color:#202124}
|
|
9
|
+
nav{padding:12px 16px;margin-bottom:28px;background:#f5f5f5;border-radius:8px}
|
|
10
|
+
nav a{margin-right:16px;text-decoration:none}
|
|
11
|
+
h1{font-size:30px;margin-top:0}
|
|
12
|
+
h2{font-size:22px;margin-top:32px}
|
|
13
|
+
h3{font-size:18px;margin-top:24px}
|
|
14
|
+
pre{background:#f6f8fa;padding:16px;border-radius:8px;overflow:auto}
|
|
15
|
+
code{background:#f1f3f4;padding:2px 5px;border-radius:4px}
|
|
16
|
+
pre code{background:none;padding:0}
|
|
17
|
+
table{border-collapse:collapse;width:100%;margin:16px 0}
|
|
18
|
+
th,td{border:1px solid #ddd;padding:8px;text-align:left}
|
|
19
|
+
th{background:#f6f6f6}
|
|
20
|
+
a{color:#0969da}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<nav>
|
|
25
|
+
<a href="../README.html">README</a>
|
|
26
|
+
<a href="end-user.html">End User</a>
|
|
27
|
+
<a href="developer.html">Application Developer</a>
|
|
28
|
+
<a href="repo-developer.html">Repository Developer</a>
|
|
29
|
+
<a href="api.html">API</a>
|
|
30
|
+
<a href="architecture.html">Architecture</a>
|
|
31
|
+
</nav>
|
|
32
|
+
<h1>Application Developer Guide</h1>
|
|
33
|
+
<p>This guide is for developers consuming Tally Public API from another application.</p>
|
|
34
|
+
<h2>Public boundary</h2>
|
|
35
|
+
<p>The consumer sees a tree-shaped JavaScript API:</p>
|
|
36
|
+
<pre><code>const result = await tally.masters.units.fetch("Mani9");</code></pre>
|
|
37
|
+
<p>The consumer does not need to know:</p>
|
|
38
|
+
<ul>
|
|
39
|
+
<li>the internal source JSON structure;</li>
|
|
40
|
+
<ul>
|
|
41
|
+
<li>the TDL request template;</li>
|
|
42
|
+
<ul>
|
|
43
|
+
<li>how traversal finds the definition;</li>
|
|
44
|
+
<ul>
|
|
45
|
+
<li>how the HTTP request is constructed.</li>
|
|
46
|
+
<h2>Company name</h2>
|
|
47
|
+
<p>The company is runtime input.</p>
|
|
48
|
+
<pre><code>await tally.masters.units.fetch("Mani9");
|
|
49
|
+
await tally.masters.units.fetch("Another Company");</code></pre>
|
|
50
|
+
<p>The company should therefore not be permanently embedded in the source definition.</p>
|
|
51
|
+
<h2>CLI / scripting</h2>
|
|
52
|
+
<p>The same public operation can be exposed through a CLI layer without duplicating the Tally definition.</p>
|
|
53
|
+
<h2>Response</h2>
|
|
54
|
+
<p>The package returns the Tally response body. XML parsing and application-specific normalization remain outside this package.</p>
|
|
55
|
+
<p>For the internal architecture, see <a href="repo-developer.md">Repository Developer Guide</a>.</p>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[**View this document as HTML**](./developer.html)
|
|
2
|
+
|
|
3
|
+
# Application Developer Guide
|
|
4
|
+
|
|
5
|
+
This guide is for developers consuming Tally Public API from another application.
|
|
6
|
+
|
|
7
|
+
## Public boundary
|
|
8
|
+
|
|
9
|
+
The consumer sees a tree-shaped JavaScript API:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
const result = await tally.masters.units.fetch("Mani9");
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The consumer does not need to know:
|
|
16
|
+
|
|
17
|
+
- the internal source JSON structure;
|
|
18
|
+
- the TDL request template;
|
|
19
|
+
- how traversal finds the definition;
|
|
20
|
+
- how the HTTP request is constructed.
|
|
21
|
+
|
|
22
|
+
## Company name
|
|
23
|
+
|
|
24
|
+
The company is runtime input.
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
await tally.masters.units.fetch("Mani9");
|
|
28
|
+
await tally.masters.units.fetch("Another Company");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The company should therefore not be permanently embedded in the source definition.
|
|
32
|
+
|
|
33
|
+
## CLI / scripting
|
|
34
|
+
|
|
35
|
+
The same public operation can be exposed through a CLI layer without duplicating the Tally definition.
|
|
36
|
+
|
|
37
|
+
## Response
|
|
38
|
+
|
|
39
|
+
The package returns the Tally response body. XML parsing and application-specific normalization remain outside this package.
|
|
40
|
+
|
|
41
|
+
For the internal architecture, see [Repository Developer Guide](repo-developer.md).
|
|
@@ -0,0 +1,49 @@
|
|
|
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">
|
|
6
|
+
<title>End User</title>
|
|
7
|
+
<style>
|
|
8
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;max-width:900px;margin:40px auto;padding:0 24px;line-height:1.65;color:#202124}
|
|
9
|
+
nav{padding:12px 16px;margin-bottom:28px;background:#f5f5f5;border-radius:8px}
|
|
10
|
+
nav a{margin-right:16px;text-decoration:none}
|
|
11
|
+
h1{font-size:30px;margin-top:0}
|
|
12
|
+
h2{font-size:22px;margin-top:32px}
|
|
13
|
+
h3{font-size:18px;margin-top:24px}
|
|
14
|
+
pre{background:#f6f8fa;padding:16px;border-radius:8px;overflow:auto}
|
|
15
|
+
code{background:#f1f3f4;padding:2px 5px;border-radius:4px}
|
|
16
|
+
pre code{background:none;padding:0}
|
|
17
|
+
table{border-collapse:collapse;width:100%;margin:16px 0}
|
|
18
|
+
th,td{border:1px solid #ddd;padding:8px;text-align:left}
|
|
19
|
+
th{background:#f6f6f6}
|
|
20
|
+
a{color:#0969da}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<nav>
|
|
25
|
+
<a href="../README.html">README</a>
|
|
26
|
+
<a href="end-user.html">End User</a>
|
|
27
|
+
<a href="developer.html">Application Developer</a>
|
|
28
|
+
<a href="repo-developer.html">Repository Developer</a>
|
|
29
|
+
<a href="api.html">API</a>
|
|
30
|
+
<a href="architecture.html">Architecture</a>
|
|
31
|
+
</nav>
|
|
32
|
+
<h1>End User Guide</h1>
|
|
33
|
+
<p>This guide is for someone who wants to use the Tally package, not modify it.</p>
|
|
34
|
+
<h2>JavaScript</h2>
|
|
35
|
+
<pre><code>import tally from "./src/index.js";
|
|
36
|
+
|
|
37
|
+
const units = await tally.masters.units.fetch("Mani9");
|
|
38
|
+
console.log(units);</code></pre>
|
|
39
|
+
<p>The company name is supplied by the caller:</p>
|
|
40
|
+
<pre><code>tally.masters.units.fetch("My Company");</code></pre>
|
|
41
|
+
<p>The package builds the Tally request internally.</p>
|
|
42
|
+
<h2>What you receive</h2>
|
|
43
|
+
<p>The Tally response is returned as XML text. This package does not force an XML-to-JSON format on the consumer.</p>
|
|
44
|
+
<p>You can parse or transform the response with the tool you prefer.</p>
|
|
45
|
+
<h2>Public API</h2>
|
|
46
|
+
<p>See <a href="api.md">API Reference</a> for the currently exposed operations.</p>
|
|
47
|
+
<p>If you are integrating this package into a larger application, continue with the <a href="developer.md">Application Developer Guide</a>.</p>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
package/docs/end-user.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[**View this document as HTML**](./end-user.html)
|
|
2
|
+
|
|
3
|
+
# End User Guide
|
|
4
|
+
|
|
5
|
+
This guide is for someone who wants to use the Tally package, not modify it.
|
|
6
|
+
|
|
7
|
+
## JavaScript
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import tally from "./src/index.js";
|
|
11
|
+
|
|
12
|
+
const units = await tally.masters.units.fetch("Mani9");
|
|
13
|
+
console.log(units);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The company name is supplied by the caller:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
tally.masters.units.fetch("My Company");
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The package builds the Tally request internally.
|
|
23
|
+
|
|
24
|
+
## What you receive
|
|
25
|
+
|
|
26
|
+
The Tally response is returned as XML text. This package does not force an XML-to-JSON format on the consumer.
|
|
27
|
+
|
|
28
|
+
You can parse or transform the response with the tool you prefer.
|
|
29
|
+
|
|
30
|
+
## Public API
|
|
31
|
+
|
|
32
|
+
See [API Reference](api.md) for the currently exposed operations.
|
|
33
|
+
|
|
34
|
+
If you are integrating this package into a larger application, continue with the [Application Developer Guide](developer.md).
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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">
|
|
6
|
+
<title>Tally Public API — Documentation</title>
|
|
7
|
+
<style>
|
|
8
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;max-width:760px;margin:60px auto;padding:0 24px;line-height:1.6;color:#222}
|
|
9
|
+
h1{margin-bottom:6px}
|
|
10
|
+
p{color:#666}
|
|
11
|
+
ul{padding-left:20px}
|
|
12
|
+
li{margin:10px 0}
|
|
13
|
+
a{text-decoration:none}
|
|
14
|
+
a:hover{text-decoration:underline}
|
|
15
|
+
small{color:#888}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<h1>Tally Public API</h1>
|
|
20
|
+
<p>Small, JSON-driven Tally query API.</p>
|
|
21
|
+
|
|
22
|
+
<ul>
|
|
23
|
+
<li><a href="end-user.html">End User</a> — use the package</li>
|
|
24
|
+
<li><a href="developer.html">Application Developer</a> — integrate the package</li>
|
|
25
|
+
<li><a href="repo-developer.html">Repository Developer</a> — maintain the repository</li>
|
|
26
|
+
<li><a href="api.html">API Reference</a> — public API paths</li>
|
|
27
|
+
<li><a href="architecture.html">Architecture</a> — how it works</li>
|
|
28
|
+
</ul>
|
|
29
|
+
|
|
30
|
+
<p><small><a href="../README.html">README</a> · <a href="../README.md">README.md</a></small></p>
|
|
31
|
+
</body>
|
|
32
|
+
</html>
|
|
@@ -0,0 +1,91 @@
|
|
|
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">
|
|
6
|
+
<title>Repo Developer</title>
|
|
7
|
+
<style>
|
|
8
|
+
body{font-family:system-ui,-apple-system,Segoe UI,Arial,sans-serif;max-width:900px;margin:40px auto;padding:0 24px;line-height:1.65;color:#202124}
|
|
9
|
+
nav{padding:12px 16px;margin-bottom:28px;background:#f5f5f5;border-radius:8px}
|
|
10
|
+
nav a{margin-right:16px;text-decoration:none}
|
|
11
|
+
h1{font-size:30px;margin-top:0}
|
|
12
|
+
h2{font-size:22px;margin-top:32px}
|
|
13
|
+
h3{font-size:18px;margin-top:24px}
|
|
14
|
+
pre{background:#f6f8fa;padding:16px;border-radius:8px;overflow:auto}
|
|
15
|
+
code{background:#f1f3f4;padding:2px 5px;border-radius:4px}
|
|
16
|
+
pre code{background:none;padding:0}
|
|
17
|
+
table{border-collapse:collapse;width:100%;margin:16px 0}
|
|
18
|
+
th,td{border:1px solid #ddd;padding:8px;text-align:left}
|
|
19
|
+
th{background:#f6f6f6}
|
|
20
|
+
a{color:#0969da}
|
|
21
|
+
</style>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<nav>
|
|
25
|
+
<a href="../README.html">README</a>
|
|
26
|
+
<a href="end-user.html">End User</a>
|
|
27
|
+
<a href="developer.html">Application Developer</a>
|
|
28
|
+
<a href="repo-developer.html">Repository Developer</a>
|
|
29
|
+
<a href="api.html">API</a>
|
|
30
|
+
<a href="architecture.html">Architecture</a>
|
|
31
|
+
</nav>
|
|
32
|
+
<h1>Repository Developer Guide</h1>
|
|
33
|
+
<p>This guide is for developers who change the repository itself.</p>
|
|
34
|
+
<h2>Source of truth</h2>
|
|
35
|
+
<p>The active version contains the Tally definitions:</p>
|
|
36
|
+
<pre><code>src/
|
|
37
|
+
└── v1/
|
|
38
|
+
├── source.json
|
|
39
|
+
├── traverse.js
|
|
40
|
+
├── traverseObject/
|
|
41
|
+
├── external-api/
|
|
42
|
+
│ ├── api.json
|
|
43
|
+
│ ├── api.js
|
|
44
|
+
│ └── index.js
|
|
45
|
+
└── index.js</code></pre>
|
|
46
|
+
<p><code>source.json</code> contains the internal request definitions.</p>
|
|
47
|
+
<p><code>external-api/api.json</code> contains only the public paths.</p>
|
|
48
|
+
<p>That separation is intentional.</p>
|
|
49
|
+
<h2>Adding a public operation</h2>
|
|
50
|
+
<p>1. Add or change the internal TDL definition in <code>source.json</code>.</p>
|
|
51
|
+
<p>2. Add its public path to <code>external-api/api.json</code>.</p>
|
|
52
|
+
<p>3. Regenerate <code>src/index.d.ts</code>.</p>
|
|
53
|
+
<p>4. Test the public call.</p>
|
|
54
|
+
<p>5. Leave older source versions untouched.</p>
|
|
55
|
+
<h2>Company input</h2>
|
|
56
|
+
<p>Do not hardcode a real company name into the public definition.</p>
|
|
57
|
+
<p>The caller supplies the company:</p>
|
|
58
|
+
<pre><code>tally.masters.units.fetch("Mani9");</code></pre>
|
|
59
|
+
<p>The runtime passes that value into the request builder.</p>
|
|
60
|
+
<h2>Traversal</h2>
|
|
61
|
+
<p>Traversal should remain generic.</p>
|
|
62
|
+
<p>Its job is to locate the requested definition.</p>
|
|
63
|
+
<p>The action/request layer interprets the terminal definition and performs the Tally HTTP request.</p>
|
|
64
|
+
<p>Avoid putting endpoint-specific paths directly into the traversal engine.</p>
|
|
65
|
+
<h2>Versioning</h2>
|
|
66
|
+
<p>When a new implementation is required:</p>
|
|
67
|
+
<pre><code>src/v1
|
|
68
|
+
src/v2
|
|
69
|
+
src/v3</code></pre>
|
|
70
|
+
<p>Create the next version and make the root <code>src/index.js</code> point to the highest active version.</p>
|
|
71
|
+
<p>Do not rewrite old versions merely to keep them visually consistent.</p>
|
|
72
|
+
<h2>Declaration generation</h2>
|
|
73
|
+
<p>The generated declaration file represents the public API tree.</p>
|
|
74
|
+
<p>It should be generated from the public API definition rather than manually maintained.</p>
|
|
75
|
+
<pre><code>node generate-dts.js</code></pre>
|
|
76
|
+
<h2>Testing</h2>
|
|
77
|
+
<p>Test both:</p>
|
|
78
|
+
<p>1. the public JavaScript API;</p>
|
|
79
|
+
<p>2. the generated request sent to Tally.</p>
|
|
80
|
+
<p>Keep Tally-specific request definitions in JSON where possible so adding another operation is primarily a data change rather than a new JavaScript module.</p>
|
|
81
|
+
<h2>Design boundary</h2>
|
|
82
|
+
<p>The repository deliberately has three layers:</p>
|
|
83
|
+
<pre><code>public API
|
|
84
|
+
↓
|
|
85
|
+
traversal / execution
|
|
86
|
+
↓
|
|
87
|
+
source JSON</code></pre>
|
|
88
|
+
<p>The public consumer sees the first layer.</p>
|
|
89
|
+
<p>The repository developer maintains all three.</p>
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
[**View this document as HTML**](./repo-developer.html)
|
|
2
|
+
|
|
3
|
+
# Repository Developer Guide
|
|
4
|
+
|
|
5
|
+
This guide is for developers who change the repository itself.
|
|
6
|
+
|
|
7
|
+
## Source of truth
|
|
8
|
+
|
|
9
|
+
The active version contains the Tally definitions:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
src/
|
|
13
|
+
└── v1/
|
|
14
|
+
├── source.json
|
|
15
|
+
├── traverse.js
|
|
16
|
+
├── traverseObject/
|
|
17
|
+
├── external-api/
|
|
18
|
+
│ ├── api.json
|
|
19
|
+
│ ├── api.js
|
|
20
|
+
│ └── index.js
|
|
21
|
+
└── index.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`source.json` contains the internal request definitions.
|
|
25
|
+
|
|
26
|
+
`external-api/api.json` contains only the public paths.
|
|
27
|
+
|
|
28
|
+
That separation is intentional.
|
|
29
|
+
|
|
30
|
+
## Adding a public operation
|
|
31
|
+
|
|
32
|
+
1. Add or change the internal TDL definition in `source.json`.
|
|
33
|
+
2. Add its public path to `external-api/api.json`.
|
|
34
|
+
3. Regenerate `src/index.d.ts`.
|
|
35
|
+
4. Test the public call.
|
|
36
|
+
5. Leave older source versions untouched.
|
|
37
|
+
|
|
38
|
+
## Company input
|
|
39
|
+
|
|
40
|
+
Do not hardcode a real company name into the public definition.
|
|
41
|
+
|
|
42
|
+
The caller supplies the company:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
tally.masters.units.fetch("Mani9");
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The runtime passes that value into the request builder.
|
|
49
|
+
|
|
50
|
+
## Traversal
|
|
51
|
+
|
|
52
|
+
Traversal should remain generic.
|
|
53
|
+
|
|
54
|
+
Its job is to locate the requested definition.
|
|
55
|
+
|
|
56
|
+
The action/request layer interprets the terminal definition and performs the Tally HTTP request.
|
|
57
|
+
|
|
58
|
+
Avoid putting endpoint-specific paths directly into the traversal engine.
|
|
59
|
+
|
|
60
|
+
## Versioning
|
|
61
|
+
|
|
62
|
+
When a new implementation is required:
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
src/v1
|
|
66
|
+
src/v2
|
|
67
|
+
src/v3
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Create the next version and make the root `src/index.js` point to the highest active version.
|
|
71
|
+
|
|
72
|
+
Do not rewrite old versions merely to keep them visually consistent.
|
|
73
|
+
|
|
74
|
+
## Declaration generation
|
|
75
|
+
|
|
76
|
+
The generated declaration file represents the public API tree.
|
|
77
|
+
|
|
78
|
+
It should be generated from the public API definition rather than manually maintained.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
node generate-dts.js
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Testing
|
|
85
|
+
|
|
86
|
+
Test both:
|
|
87
|
+
|
|
88
|
+
1. the public JavaScript API;
|
|
89
|
+
2. the generated request sent to Tally.
|
|
90
|
+
|
|
91
|
+
Keep Tally-specific request definitions in JSON where possible so adding another operation is primarily a data change rather than a new JavaScript module.
|
|
92
|
+
|
|
93
|
+
## Design boundary
|
|
94
|
+
|
|
95
|
+
The repository deliberately has three layers:
|
|
96
|
+
|
|
97
|
+
```text
|
|
98
|
+
public API
|
|
99
|
+
↓
|
|
100
|
+
traversal / execution
|
|
101
|
+
↓
|
|
102
|
+
source JSON
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The public consumer sees the first layer.
|
|
106
|
+
|
|
107
|
+
The repository developer maintains all three.
|