From 7ebd665c76c526d0fb9449d3c18374742e4117b6 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 04:57:49 +0100 Subject: [PATCH] =?UTF-8?q?A7=20N-2,=20=C2=A7411:=20the-private-network's?= =?UTF-8?q?=20TypeScript=20contract=20regenerated=20as=20index.js=20and=20?= =?UTF-8?q?index.d.ts;=20no=20artifact=20keeps=20a=20series?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G §339, §341, §411 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-connectivity-contracts/module.json | 2 -- .../{src/index.ts => index.d.ts} | 2 +- .../ts/seats/theprivatenetwork/index.js | 6 ++++ .../ts/seats/theprivatenetwork/package.json | 11 +++++-- .../ts/seats/theprivatenetwork/tsconfig.json | 12 -------- .../mesh-wireguard/go/overlay/seat_test.go | 30 +++++++++++++++++++ modules/mesh-wireguard/module.json | 3 +- 7 files changed, 46 insertions(+), 20 deletions(-) rename modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/{src/index.ts => index.d.ts} (90%) create mode 100644 modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.js delete mode 100644 modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/tsconfig.json diff --git a/modules/mesh-connectivity-contracts/module.json b/modules/mesh-connectivity-contracts/module.json index 18cf8a9..bf62945 100644 --- a/modules/mesh-connectivity-contracts/module.json +++ b/modules/mesh-connectivity-contracts/module.json @@ -10,7 +10,6 @@ "paths": [ "go/seats/theprivatenetwork" ], - "series": "0.1", "generated-from": "." }, { @@ -20,7 +19,6 @@ "paths": [ "ts/seats/theprivatenetwork" ], - "series": "0.1", "generated-from": "." } ] diff --git a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/src/index.ts b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.d.ts similarity index 90% rename from modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/src/index.ts rename to modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.d.ts index d04f2cd..6a37d20 100644 --- a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/src/index.ts +++ b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.d.ts @@ -2,7 +2,7 @@ // The contract of the seat "the-private-network", defined whole (seats/the-private-network/seat.json): The seat of the private network (ADR 0110): the one network the mesh runs over, which a machine can have only one of; the mesh provides its holder itself and the provision carries no fields. -export const seat = "the-private-network"; +export declare const seat: "the-private-network"; /** is the form of the provision private-network. */ export type PrivateNetworkForm = Record; diff --git a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.js b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.js new file mode 100644 index 0000000..211e89d --- /dev/null +++ b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/index.js @@ -0,0 +1,6 @@ +// Code generated by seatgen from the seat definitions; DO NOT EDIT. + +// The contract of the seat "the-private-network", defined whole (seats/the-private-network/seat.json): The seat of the private network (ADR 0110): the one network the mesh runs over, which a machine can have only one of; the mesh provides its holder itself and the provision carries no fields. + +export const seat = "the-private-network"; + diff --git a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/package.json b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/package.json index 2425c77..ea2fdc1 100644 --- a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/package.json +++ b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/package.json @@ -1,13 +1,18 @@ { "description": "The contract of the seat the-private-network, generated from its definition.", "exports": { - ".": "./src/index.ts" + ".": { + "default": "./index.js", + "types": "./index.d.ts" + } }, "files": [ - "src" + "index.js", + "index.d.ts", + "parts" ], "name": "@novox/mesh-connectivity-contracts-the-private-network", "type": "module", - "types": "./src/index.ts", + "types": "./index.d.ts", "version": "0.1.0" } diff --git a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/tsconfig.json b/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/tsconfig.json deleted file mode 100644 index 60274c6..0000000 --- a/modules/mesh-connectivity-contracts/ts/seats/theprivatenetwork/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "noEmit": true, - "strict": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["src/**/*.ts"] -} diff --git a/modules/mesh-wireguard/go/overlay/seat_test.go b/modules/mesh-wireguard/go/overlay/seat_test.go index ce2811c..ce4b39e 100644 --- a/modules/mesh-wireguard/go/overlay/seat_test.go +++ b/modules/mesh-wireguard/go/overlay/seat_test.go @@ -74,3 +74,33 @@ func TestEveryProvisionTheModuleOffersSaysItsCredentialForm(t *testing.T) { } } } + +// Design 47 G §411, §339, §341: no artifact of this repository's manifests keeps a `series` (one version per module), and +// the generated TypeScript contract is `index.js` with its `index.d.ts`, with no source for a build of its own. +func TestNoArtifactKeepsASeriesAndTheTypeScriptContractIsJavaScript(t *testing.T) { + for _, path := range []string{"../../module.json", "../../../mesh-connectivity-contracts/module.json"} { + file, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + var m struct { + Build struct { + Artifacts []map[string]any `json:"artifacts"` + } `json:"build"` + } + if err := json.Unmarshal(file, &m); err != nil { + t.Fatal(err) + } + for _, a := range m.Build.Artifacts { + if _, ok := a["series"]; ok { + t.Errorf("%s: the artifact %v keeps a series, which the manifest validator refuses (§411)", path, a["name"]) + } + } + } + dir := "../../../mesh-connectivity-contracts/ts/seats/theprivatenetwork/" + for file, want := range map[string]bool{"index.js": true, "index.d.ts": true, "src/index.ts": false, "tsconfig.json": false} { + if _, err := os.Stat(dir + file); (err == nil) != want { + t.Errorf("%s: present %v, want %v (§341)", file, err == nil, want) + } + } +} diff --git a/modules/mesh-wireguard/module.json b/modules/mesh-wireguard/module.json index c511585..b497e71 100644 --- a/modules/mesh-wireguard/module.json +++ b/modules/mesh-wireguard/module.json @@ -30,8 +30,7 @@ "language": "go", "paths": [ "go" - ], - "series": "0.1" + ] } ] }