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/development.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Developer guide
|
|
2
|
-
|
|
3
|
-
This document explains how Tally Simple is built and how to change it. End-user installation and query examples are kept in the root README.
|
|
4
|
-
|
|
5
|
-
## The developer story
|
|
6
|
-
|
|
7
|
-
Tally Simple keeps the TDL request definitions in one internal source and exposes only the queries deliberately selected for users.
|
|
8
|
-
|
|
9
|
-
~~~text
|
|
10
|
-
source.json
|
|
11
|
-
│
|
|
12
|
-
├── public API list ──> JavaScript client
|
|
13
|
-
│
|
|
14
|
-
└── request traversal ──> XML over HTTP ──> Tally
|
|
15
|
-
│
|
|
16
|
-
└──> CLI stdout
|
|
17
|
-
~~~
|
|
18
|
-
|
|
19
|
-
The source definitions describe how Tally should answer a query. The public API list is the product boundary: only listed paths become JavaScript methods and CLI commands.
|
|
20
|
-
|
|
21
|
-
## Repository map
|
|
22
|
-
|
|
23
|
-
- src/v1/source.json: Tally connection defaults, request envelope, and TDL collections.
|
|
24
|
-
- src/v1/external-api/api.json: public query allowlist.
|
|
25
|
-
- src/v1/external-api/api.js: builds the nested runtime API.
|
|
26
|
-
- src/v1/traverse.js: validates, builds, and sends a request.
|
|
27
|
-
- src/index.d.ts: generated TypeScript declarations.
|
|
28
|
-
- bin/tally-simple.js: command-line entrypoint.
|
|
29
|
-
- test/test.js and test/units.js: offline behavior and CLI tests.
|
|
30
|
-
- test/v1/units.js: manual integration smoke check against a reachable Tally instance; it is not part of npm test.
|
|
31
|
-
|
|
32
|
-
## Request lifecycle
|
|
33
|
-
|
|
34
|
-
1. The application or CLI selects a public query path.
|
|
35
|
-
2. The client validates and trims the company name.
|
|
36
|
-
3. The path is resolved in source.json.
|
|
37
|
-
4. The company name is XML-escaped and inserted into the request envelope.
|
|
38
|
-
5. The selected collection body is inserted into the envelope.
|
|
39
|
-
6. The configured fetch implementation sends the request to Tally.
|
|
40
|
-
7. The response body is returned as text; non-2xx responses become errors.
|
|
41
|
-
|
|
42
|
-
## Adding a query
|
|
43
|
-
|
|
44
|
-
1. Add or update the TDL definition in src/v1/source.json.
|
|
45
|
-
2. Add its complete path to src/v1/external-api/api.json.
|
|
46
|
-
3. Run npm run generate:dts.
|
|
47
|
-
4. Add or update an offline test.
|
|
48
|
-
5. Run npm run verify.
|
|
49
|
-
|
|
50
|
-
Do not edit src/index.d.ts by hand. It is generated from the source definition and public path list.
|
|
51
|
-
|
|
52
|
-
## Client configuration
|
|
53
|
-
|
|
54
|
-
createTallyClient() is the application boundary for a different URL, method, headers, timeout, or fetch implementation. The default import uses the default connection from source.json.
|
|
55
|
-
|
|
56
|
-
The fetch option is intentionally injectable so tests can run without a Tally installation or network connection.
|
|
57
|
-
|
|
58
|
-
## Verification and publishing
|
|
59
|
-
|
|
60
|
-
~~~bash
|
|
61
|
-
npm install
|
|
62
|
-
npm run verify
|
|
63
|
-
npm pack --dry-run
|
|
64
|
-
~~~
|
|
65
|
-
|
|
66
|
-
The prepack and prepublishOnly hooks run declaration generation and the offline test suite. The package files allowlist publishes the runtime, CLI, user documentation, and package metadata while excluding tests and development-only scripts.
|
package/docs/usage.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Usage
|
|
2
|
-
|
|
3
|
-
## The shortest library path
|
|
4
|
-
|
|
5
|
-
~~~js
|
|
6
|
-
import tally from "tally-simple";
|
|
7
|
-
|
|
8
|
-
const response = await tally.masters.units.fetch("Mani9");
|
|
9
|
-
~~~
|
|
10
|
-
|
|
11
|
-
Every endpoint takes a company name. Blank names are rejected before a request is sent.
|
|
12
|
-
|
|
13
|
-
## Configure a client
|
|
14
|
-
|
|
15
|
-
~~~js
|
|
16
|
-
import { createTallyClient } from "tally-simple";
|
|
17
|
-
|
|
18
|
-
const tally = createTallyClient({
|
|
19
|
-
url: "http://localhost:9000",
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: "Bearer example"
|
|
22
|
-
},
|
|
23
|
-
timeout: 15_000
|
|
24
|
-
});
|
|
25
|
-
~~~
|
|
26
|
-
|
|
27
|
-
Options:
|
|
28
|
-
|
|
29
|
-
- url: Tally HTTP endpoint. The default is http://localhost:9000.
|
|
30
|
-
- method: request method. The default is POST.
|
|
31
|
-
- headers: headers merged with the default Content-Type: text/xml.
|
|
32
|
-
- timeout: optional request timeout in milliseconds.
|
|
33
|
-
- fetch: optional fetch-compatible function, useful for tests or an application adapter.
|
|
34
|
-
|
|
35
|
-
The endpoint returns the response text. HTTP responses outside the 2xx range throw an error containing the status and response body.
|
|
36
|
-
|
|
37
|
-
## Test without Tally
|
|
38
|
-
|
|
39
|
-
~~~js
|
|
40
|
-
import { createTallyClient } from "tally-simple";
|
|
41
|
-
|
|
42
|
-
const tally = createTallyClient({
|
|
43
|
-
fetch: async (url, options) => {
|
|
44
|
-
console.log(url, options.body);
|
|
45
|
-
return {
|
|
46
|
-
ok: true,
|
|
47
|
-
status: 200,
|
|
48
|
-
text: async () => "<ENVELOPE><STATUS>1</STATUS></ENVELOPE>"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const response = await tally.masters.units.fetch("Mani9");
|
|
54
|
-
~~~
|
|
55
|
-
|
|
56
|
-
The package escapes XML-sensitive characters in the company name before inserting it into the request.
|
|
57
|
-
|
|
58
|
-
## TypeScript
|
|
59
|
-
|
|
60
|
-
The package ships declarations generated from the public API definition:
|
|
61
|
-
|
|
62
|
-
~~~ts
|
|
63
|
-
import { createTallyClient } from "tally-simple";
|
|
64
|
-
|
|
65
|
-
const tally = createTallyClient();
|
|
66
|
-
const response: Promise<string> = tally.masters.units.fetch("Mani9");
|
|
67
|
-
~~~
|
|
68
|
-
|
|
69
|
-
Regenerate the declarations after changing an API path:
|
|
70
|
-
|
|
71
|
-
~~~bash
|
|
72
|
-
npm run generate:dts
|
|
73
|
-
~~~
|