@procedures/rational 0.0.0-stage → 0.62.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 ADDED
@@ -0,0 +1,20 @@
1
+ # @procedures/rational
2
+
3
+ ## 0.62.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2988fba: A new wrap of kind 1, made from the types of its home, with no procedure written by hand:
8
+
9
+ - `@procedures/rational`: 24 of 24 functions of `@mark1russell7/rational`, exact fractions over `bigint`. The codecs of the generator give each `bigint` as a decimal string, so a rational is `{ "n": "3", "d": "2" }` in JSON.
10
+
11
+ The wrap is pure. `wraps.programs.json` has a new program across two libraries: the seconds of 0.1 h plus 0.2 h, with no rounding (rational and quantity). It gives 1080 exactly.
12
+
13
+ `@procedures/quantity` uses `@mark1russell7/rational` 0.1.3, the version of the new wrap, in place of 0.1.2.
14
+
15
+ PATCH: before 1.0.0, a backward-compatible feature raises PATCH. The new package adds procedures and changes no procedure of another package.
16
+ - Updated dependencies [4ce6ac9]
17
+ - Updated dependencies [02582c5]
18
+ - Updated dependencies [365aad4]
19
+ - @procedures/compiler@0.62.1
20
+ - @procedures/client@0.62.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Mark Russell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,66 @@
1
- # Temporary Holding Version
1
+ # @procedures/rational
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@procedures/rational?color=2346c4&label=npm)](https://www.npmjs.com/package/@procedures/rational)
4
+
5
+ The functions of [`@mark1russell7/rational`](https://www.npmjs.com/package/@mark1russell7/rational) as procedures: exact rationals over `bigint`, always in lowest terms. The package has their sums, products, powers, roots, comparisons and roundings. Each procedure is a typed call, an MCP tool and a CLI command.
6
+
7
+ No procedure is written by hand. The generator of `@procedures/compiler` reads the types of the library and writes `src/manifest.ts`. Thus a procedure cannot drift from its function.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @procedures/rational @procedures/client
13
+ ```
14
+
15
+ A host registers the procedures with `createRegistry(rationalModule)`, or with `import "@procedures/rational/register"` for the global registry. The package root and `./module` register nothing.
16
+
17
+ ## Procedures
18
+
19
+ The package has 24 procedures in the namespace `rational`, one for each function of the library. Each procedure has no effects: it reads nothing and writes nothing.
20
+
21
+ - The input is an object with one property for each parameter of the function, by its name.
22
+ - The JSON Schemas of the input and the output come from the types. A named type has one definition in `$defs`.
23
+ - A `bigint` is a decimal string in JSON, for example `"9007199254740993"`. The codec of the generator keeps each digit, also past 2^53.
24
+ - A rational is the object `{ "n": "3", "d": "2" }`. The procedure decodes it before the call and encodes the result after the call.
25
+ - A number in place of a decimal string is not in the schema, so the procedure refuses it.
26
+
27
+ `rationalManifest` gives the names, the schemas and the effects of each procedure.
28
+
29
+ ## Example
30
+
31
+ ```ts
32
+ import { createRegistry, invokePath, outputValue } from "@procedures/client";
33
+ import { rationalModule } from "@procedures/rational";
34
+
35
+ const registry = createRegistry(rationalModule);
36
+ const output = await invokePath(["rational", "add"], { a: { n: "1", d: "3" }, b: { n: "1", d: "6" } }, { registry });
37
+ const value = await outputValue(output); // { n: "1", d: "2" }
38
+ ```
39
+
40
+ ## The functions with no procedure
41
+
42
+ Each function of the library has a procedure. The values `ONE` and `ZERO` are not functions, so they have no procedure.
43
+
44
+ ## Update the manifest
45
+
46
+ After an update of `@mark1russell7/rational`, start this command from the root of the repository:
47
+
48
+ ```bash
49
+ node scripts/wraps.ts generate --package rational
50
+ ```
51
+
52
+ The command writes `src/manifest.ts`. It also raises the ratchet of the library in `wraps.coverage.json`. CI starts `node scripts/wraps.ts check`. The check fails when the manifest is not current, or when the share of the functions with a procedure falls.
53
+
54
+ ## The gate of a pure wrap
55
+
56
+ The wrap is pure: its `wrap.json` has `"pure": true`. So `node scripts/wraps.ts check` also examines these conditions:
57
+
58
+ - Each procedure has no effects.
59
+ - The field `client.browser` lists `.`, `./module` and `./register`.
60
+ - A program of `wraps.programs.json` uses a procedure of the wrap.
61
+
62
+ The programs of `wraps.programs.json`, at the root of the repository, use the procedures of the pure wraps, also across libraries. The check starts each program two times. The two results must be equal, and equal to the recorded result.
63
+
64
+ ## License
65
+
66
+ MIT
@@ -0,0 +1,2 @@
1
+ export * from "./module.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // The root registers nothing: import "@procedures/rational/register", or give the module to createRegistry()
2
+ export * from "./module.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,cAAc,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ExportsManifest } from "@procedures/compiler";
2
+ export declare const manifest: ExportsManifest;
3
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,eAAO,MAAM,QAAQ,EAAE,eAy1BtB,CAAC"}