diff --git a/README.md b/README.md index 7e28e12..f7e7fcc 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,13 @@ implements its contract, and no holder's code lives here. mesh-sdk's `seatdef` is the one reader of the format; the indexer and the generators use it. - **The seat set**, generated: `go/seats` (module `git.novox.be/novox/mesh-contracts/go`), every seat's name, scope, verbs and provision at the seat list's grain (ADR 0625 §2). mesh-sdk's `catalogue` is its only importer in mesh-sdk. - A change of it rebuilds every importer of the seat set. + A change of it rebuilds every importer of the seat set. Its npm package is `ts/` (`@novox/mesh-contracts`, the + seat list alone). - **A seat defined whole**, generated: `go/seats/`, a Go module of its own importing nothing, holding the seat's verbs, events and subjects, its message types and a test of its fixtures (ADR 0625 §1). A module - imports only the seats it uses, so a change of one seat rebuilds only its users. The TypeScript side is `ts/src/`. + imports only the seats it uses, so a change of one seat rebuilds only its users. Its npm package is + `ts/seats/` (`@novox/mesh-contracts-`), holding the parts it includes whole: the indexer + counts the npm package a lock resolves, so here too a module is rebuilt only for the seats it uses. - **A seat's client**, written by hand: `go/clients/client`, a Go module of its own, only where two or more callers share logic over the seat (ADR 0625 §4, ADR 0627 §1): operator-channel's (checking an ask, its digest, a warrant's, and an asking module's keeping of its asks) and the four registry seats' (publishing a file @@ -29,4 +32,4 @@ implements its contract, and no holder's code lives here. Every file under `go/` and `ts/` outside `go/clients/` is written by the generator (seatgen, the source of the Go and Node build modules' generate step) and compared on every build: a hand-written file there fails, named (ADR 0625 §5). `seatgen -check` also runs the client check (each client is for a seat defined whole, a module of its own, importing -only its seat's contract and mesh-sdk) and checks `module.json`'s Go package artifacts against the tree. +only its seat's contract and mesh-sdk) and checks `module.json`'s Go and npm package artifacts against the tree. diff --git a/module.json b/module.json index fd20a00..15e7a19 100644 --- a/module.json +++ b/module.json @@ -19,7 +19,16 @@ { "name": "go-npmpackageregistry", "kind": "package", "language": "go", "paths": ["go/seats/npmpackageregistry"], "series": "0.1", "generated-from": "." }, { "name": "go-ociartifactregistry", "kind": "package", "language": "go", "paths": ["go/seats/ociartifactregistry"], "series": "0.1", "generated-from": "." }, { "name": "go-operatorchannel", "kind": "package", "language": "go", "paths": ["go/seats/operatorchannel"], "series": "0.1", "generated-from": "." }, - { "name": "lib", "kind": "package", "language": "typescript", "paths": ["ts"], "series": "0.1", "generated-from": "." } + { "name": "lib", "kind": "package", "language": "typescript", "paths": ["ts"], "series": "0.1", "generated-from": "." }, + { "name": "ts-containerimageregistry", "kind": "package", "language": "typescript", "paths": ["ts/seats/containerimageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "ts-gopackageregistry", "kind": "package", "language": "typescript", "paths": ["ts/seats/gopackageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "ts-meshbroker", "kind": "package", "language": "typescript", "paths": ["ts/seats/meshbroker"], "series": "0.1", "generated-from": "." }, + { "name": "ts-meshconfig", "kind": "package", "language": "typescript", "paths": ["ts/seats/meshconfig"], "series": "0.1", "generated-from": "." }, + { "name": "ts-meshdeliverychecker", "kind": "package", "language": "typescript", "paths": ["ts/seats/meshdeliverychecker"], "series": "0.1", "generated-from": "." }, + { "name": "ts-meshvault", "kind": "package", "language": "typescript", "paths": ["ts/seats/meshvault"], "series": "0.1", "generated-from": "." }, + { "name": "ts-npmpackageregistry", "kind": "package", "language": "typescript", "paths": ["ts/seats/npmpackageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "ts-ociartifactregistry", "kind": "package", "language": "typescript", "paths": ["ts/seats/ociartifactregistry"], "series": "0.1", "generated-from": "." }, + { "name": "ts-operatorchannel", "kind": "package", "language": "typescript", "paths": ["ts/seats/operatorchannel"], "series": "0.1", "generated-from": "." } ] }, "resources": [] diff --git a/ts/package.json b/ts/package.json index 28bd3f5..cd5565a 100644 --- a/ts/package.json +++ b/ts/package.json @@ -1,5 +1,5 @@ { - "description": "The mesh's seat contracts, generated from their definitions.", + "description": "The mesh's seat set, generated from every seat's definition.", "devDependencies": { "typescript": "^5.6.0" }, diff --git a/ts/seats/containerimageregistry/package.json b/ts/seats/containerimageregistry/package.json new file mode 100644 index 0000000..5a3ac9d --- /dev/null +++ b/ts/seats/containerimageregistry/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat container-image-registry, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-container-image-registry", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/container-image-registry.ts b/ts/seats/containerimageregistry/src/index.ts similarity index 100% rename from ts/src/container-image-registry.ts rename to ts/seats/containerimageregistry/src/index.ts diff --git a/ts/src/parts/registry.ts b/ts/seats/containerimageregistry/src/parts/registry.ts similarity index 100% rename from ts/src/parts/registry.ts rename to ts/seats/containerimageregistry/src/parts/registry.ts diff --git a/ts/seats/containerimageregistry/tsconfig.json b/ts/seats/containerimageregistry/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/containerimageregistry/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/gopackageregistry/package.json b/ts/seats/gopackageregistry/package.json new file mode 100644 index 0000000..f8dd34e --- /dev/null +++ b/ts/seats/gopackageregistry/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat go-package-registry, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-go-package-registry", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/go-package-registry.ts b/ts/seats/gopackageregistry/src/index.ts similarity index 100% rename from ts/src/go-package-registry.ts rename to ts/seats/gopackageregistry/src/index.ts diff --git a/ts/seats/gopackageregistry/src/parts/registry.ts b/ts/seats/gopackageregistry/src/parts/registry.ts new file mode 100644 index 0000000..9642c2d --- /dev/null +++ b/ts/seats/gopackageregistry/src/parts/registry.ts @@ -0,0 +1,175 @@ +// Code generated by seatgen from the seat definitions; DO NOT EDIT. + +// The part "registry" several seats include whole: The verbs and events every registry seat shares, written once so the four cannot drift (design 51, design 26). Who may call each verb is the holder's trusted config value listing its callers (ADR 0363's form), checked against the caller the tool runner proved. + +export const verbs = { + publish: "publish", + publishPart: "publish-part", + versions: "versions", + remove: "remove", +} as const; + +export const events = { + published: "published", + refused: "refused", + removed: "removed", +} as const; + +/** one published thing, as every registry event and answer names it */ +export interface Artifact { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** the body of published, refused and removed */ +export interface Outcome { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** the module holding the seat that said it */ + "holder": string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the Go module path a Go package is fetched under (go-package-registry's published); empty for every other kind of artifact */ + "module"?: string; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) */ + "reason"?: string; + /** the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) */ + "reference"?: string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer it ends, when it ended one */ + "transfer"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** one part of a transfer */ +export interface Part { + /** the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob */ + "digest": string; + /** its size in bytes */ + "size": number; +} + +/** is what publish takes. */ +export interface PublishInput { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** every part's digest and size; none when the digest is already held */ + "parts"?: Part[]; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer's name, the caller's own; the same name opens the same transfer again */ + "transfer": string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** is what publish answers. */ +export interface PublishAnswer { + /** the digest is held already: nothing to send; the outcome follows as an event */ + "held"?: boolean; + /** the digests of the parts the holder lacks, to send by publish-part */ + "lacks"?: string[]; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part takes. */ +export interface PublishPartInput { + /** the chunk's bytes, base64 (at most 760 KiB before encoding) */ + "data": string; + /** this chunk is the part's last */ + "last": boolean; + /** the part's digest */ + "part": string; + /** the chunk's place in its part, from 0 */ + "sequence": number; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part answers. */ +export interface PublishPartAnswer { + /** the part is whole and its bytes match its digest */ + "complete"?: boolean; + /** the part */ + "part": string; + /** the chunks of the part held so far */ + "received"?: number; + /** the transfer */ + "transfer": string; +} + +/** is what versions takes. */ +export interface VersionsInput { + /** narrowed to one kind (optional) */ + "kind"?: string; + /** the name */ + "name": string; +} + +/** is what versions answers. */ +export interface VersionsAnswer { + /** the name */ + "name": string; + /** newest first */ + "versions": Artifact[]; +} + +/** is what remove takes. */ +export interface RemoveInput { + /** the digest (for a bundle, archive or copied base) */ + "digest"?: string; + /** the name */ + "name": string; + /** why it goes */ + "reason": "tag-gone" | "retention"; + /** the tag (for a tagged version) */ + "tag"?: string; + /** the version */ + "version"?: string; +} + +/** is what remove answers. */ +export interface RemoveAnswer { + "artifact"?: Artifact; + /** it is gone */ + "removed": boolean; +} + +/** is the body of the event published. */ +export type PublishedEvent = Outcome; + +/** is the body of the event refused. */ +export type RefusedEvent = Outcome; + +/** is the body of the event removed. */ +export type RemovedEvent = Outcome; + diff --git a/ts/seats/gopackageregistry/tsconfig.json b/ts/seats/gopackageregistry/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/gopackageregistry/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/meshbroker/package.json b/ts/seats/meshbroker/package.json new file mode 100644 index 0000000..d93aec0 --- /dev/null +++ b/ts/seats/meshbroker/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat mesh-broker, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-mesh-broker", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/mesh-broker.ts b/ts/seats/meshbroker/src/index.ts similarity index 100% rename from ts/src/mesh-broker.ts rename to ts/seats/meshbroker/src/index.ts diff --git a/ts/seats/meshbroker/tsconfig.json b/ts/seats/meshbroker/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/meshbroker/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/meshconfig/package.json b/ts/seats/meshconfig/package.json new file mode 100644 index 0000000..af62267 --- /dev/null +++ b/ts/seats/meshconfig/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat mesh-config, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-mesh-config", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/mesh-config.ts b/ts/seats/meshconfig/src/index.ts similarity index 100% rename from ts/src/mesh-config.ts rename to ts/seats/meshconfig/src/index.ts diff --git a/ts/seats/meshconfig/tsconfig.json b/ts/seats/meshconfig/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/meshconfig/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/meshdeliverychecker/package.json b/ts/seats/meshdeliverychecker/package.json new file mode 100644 index 0000000..b842d55 --- /dev/null +++ b/ts/seats/meshdeliverychecker/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat mesh-delivery-checker, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-mesh-delivery-checker", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/mesh-delivery-checker.ts b/ts/seats/meshdeliverychecker/src/index.ts similarity index 100% rename from ts/src/mesh-delivery-checker.ts rename to ts/seats/meshdeliverychecker/src/index.ts diff --git a/ts/seats/meshdeliverychecker/tsconfig.json b/ts/seats/meshdeliverychecker/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/meshdeliverychecker/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/meshvault/package.json b/ts/seats/meshvault/package.json new file mode 100644 index 0000000..b811690 --- /dev/null +++ b/ts/seats/meshvault/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat mesh-vault, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-mesh-vault", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/mesh-vault.ts b/ts/seats/meshvault/src/index.ts similarity index 100% rename from ts/src/mesh-vault.ts rename to ts/seats/meshvault/src/index.ts diff --git a/ts/seats/meshvault/tsconfig.json b/ts/seats/meshvault/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/meshvault/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/npmpackageregistry/package.json b/ts/seats/npmpackageregistry/package.json new file mode 100644 index 0000000..506e958 --- /dev/null +++ b/ts/seats/npmpackageregistry/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat npm-package-registry, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-npm-package-registry", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/npm-package-registry.ts b/ts/seats/npmpackageregistry/src/index.ts similarity index 100% rename from ts/src/npm-package-registry.ts rename to ts/seats/npmpackageregistry/src/index.ts diff --git a/ts/seats/npmpackageregistry/src/parts/registry.ts b/ts/seats/npmpackageregistry/src/parts/registry.ts new file mode 100644 index 0000000..9642c2d --- /dev/null +++ b/ts/seats/npmpackageregistry/src/parts/registry.ts @@ -0,0 +1,175 @@ +// Code generated by seatgen from the seat definitions; DO NOT EDIT. + +// The part "registry" several seats include whole: The verbs and events every registry seat shares, written once so the four cannot drift (design 51, design 26). Who may call each verb is the holder's trusted config value listing its callers (ADR 0363's form), checked against the caller the tool runner proved. + +export const verbs = { + publish: "publish", + publishPart: "publish-part", + versions: "versions", + remove: "remove", +} as const; + +export const events = { + published: "published", + refused: "refused", + removed: "removed", +} as const; + +/** one published thing, as every registry event and answer names it */ +export interface Artifact { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** the body of published, refused and removed */ +export interface Outcome { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** the module holding the seat that said it */ + "holder": string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the Go module path a Go package is fetched under (go-package-registry's published); empty for every other kind of artifact */ + "module"?: string; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) */ + "reason"?: string; + /** the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) */ + "reference"?: string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer it ends, when it ended one */ + "transfer"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** one part of a transfer */ +export interface Part { + /** the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob */ + "digest": string; + /** its size in bytes */ + "size": number; +} + +/** is what publish takes. */ +export interface PublishInput { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** every part's digest and size; none when the digest is already held */ + "parts"?: Part[]; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer's name, the caller's own; the same name opens the same transfer again */ + "transfer": string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** is what publish answers. */ +export interface PublishAnswer { + /** the digest is held already: nothing to send; the outcome follows as an event */ + "held"?: boolean; + /** the digests of the parts the holder lacks, to send by publish-part */ + "lacks"?: string[]; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part takes. */ +export interface PublishPartInput { + /** the chunk's bytes, base64 (at most 760 KiB before encoding) */ + "data": string; + /** this chunk is the part's last */ + "last": boolean; + /** the part's digest */ + "part": string; + /** the chunk's place in its part, from 0 */ + "sequence": number; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part answers. */ +export interface PublishPartAnswer { + /** the part is whole and its bytes match its digest */ + "complete"?: boolean; + /** the part */ + "part": string; + /** the chunks of the part held so far */ + "received"?: number; + /** the transfer */ + "transfer": string; +} + +/** is what versions takes. */ +export interface VersionsInput { + /** narrowed to one kind (optional) */ + "kind"?: string; + /** the name */ + "name": string; +} + +/** is what versions answers. */ +export interface VersionsAnswer { + /** the name */ + "name": string; + /** newest first */ + "versions": Artifact[]; +} + +/** is what remove takes. */ +export interface RemoveInput { + /** the digest (for a bundle, archive or copied base) */ + "digest"?: string; + /** the name */ + "name": string; + /** why it goes */ + "reason": "tag-gone" | "retention"; + /** the tag (for a tagged version) */ + "tag"?: string; + /** the version */ + "version"?: string; +} + +/** is what remove answers. */ +export interface RemoveAnswer { + "artifact"?: Artifact; + /** it is gone */ + "removed": boolean; +} + +/** is the body of the event published. */ +export type PublishedEvent = Outcome; + +/** is the body of the event refused. */ +export type RefusedEvent = Outcome; + +/** is the body of the event removed. */ +export type RemovedEvent = Outcome; + diff --git a/ts/seats/npmpackageregistry/tsconfig.json b/ts/seats/npmpackageregistry/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/npmpackageregistry/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/ociartifactregistry/package.json b/ts/seats/ociartifactregistry/package.json new file mode 100644 index 0000000..822b791 --- /dev/null +++ b/ts/seats/ociartifactregistry/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat oci-artifact-registry, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-oci-artifact-registry", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/oci-artifact-registry.ts b/ts/seats/ociartifactregistry/src/index.ts similarity index 100% rename from ts/src/oci-artifact-registry.ts rename to ts/seats/ociartifactregistry/src/index.ts diff --git a/ts/seats/ociartifactregistry/src/parts/registry.ts b/ts/seats/ociartifactregistry/src/parts/registry.ts new file mode 100644 index 0000000..9642c2d --- /dev/null +++ b/ts/seats/ociartifactregistry/src/parts/registry.ts @@ -0,0 +1,175 @@ +// Code generated by seatgen from the seat definitions; DO NOT EDIT. + +// The part "registry" several seats include whole: The verbs and events every registry seat shares, written once so the four cannot drift (design 51, design 26). Who may call each verb is the holder's trusted config value listing its callers (ADR 0363's form), checked against the caller the tool runner proved. + +export const verbs = { + publish: "publish", + publishPart: "publish-part", + versions: "versions", + remove: "remove", +} as const; + +export const events = { + published: "published", + refused: "refused", + removed: "removed", +} as const; + +/** one published thing, as every registry event and answer names it */ +export interface Artifact { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** the body of published, refused and removed */ +export interface Outcome { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** the module holding the seat that said it */ + "holder": string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the Go module path a Go package is fetched under (go-package-registry's published); empty for every other kind of artifact */ + "module"?: string; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) */ + "reason"?: string; + /** the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) */ + "reference"?: string; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer it ends, when it ended one */ + "transfer"?: string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** one part of a transfer */ +export interface Part { + /** the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob */ + "digest": string; + /** its size in bytes */ + "size": number; +} + +/** is what publish takes. */ +export interface PublishInput { + /** the source commit it was built from */ + "commit"?: string; + /** its digest, sha256: (a Go package's h1: hash beside it in the version's record) */ + "digest": string; + /** the build's fingerprint */ + "fingerprint"?: string; + /** what it is */ + "kind": "package" | "image" | "bundle" | "archive" | "upstream"; + /** the package's, image's, bundle's or archive's name */ + "name": string; + /** every part's digest and size; none when the digest is already held */ + "parts"?: Part[]; + /** the tag it carries, for a tagged version */ + "tag"?: string; + /** the transfer's name, the caller's own; the same name opens the same transfer again */ + "transfer": string; + /** the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone */ + "version"?: string; +} + +/** is what publish answers. */ +export interface PublishAnswer { + /** the digest is held already: nothing to send; the outcome follows as an event */ + "held"?: boolean; + /** the digests of the parts the holder lacks, to send by publish-part */ + "lacks"?: string[]; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part takes. */ +export interface PublishPartInput { + /** the chunk's bytes, base64 (at most 760 KiB before encoding) */ + "data": string; + /** this chunk is the part's last */ + "last": boolean; + /** the part's digest */ + "part": string; + /** the chunk's place in its part, from 0 */ + "sequence": number; + /** the transfer */ + "transfer": string; +} + +/** is what publish-part answers. */ +export interface PublishPartAnswer { + /** the part is whole and its bytes match its digest */ + "complete"?: boolean; + /** the part */ + "part": string; + /** the chunks of the part held so far */ + "received"?: number; + /** the transfer */ + "transfer": string; +} + +/** is what versions takes. */ +export interface VersionsInput { + /** narrowed to one kind (optional) */ + "kind"?: string; + /** the name */ + "name": string; +} + +/** is what versions answers. */ +export interface VersionsAnswer { + /** the name */ + "name": string; + /** newest first */ + "versions": Artifact[]; +} + +/** is what remove takes. */ +export interface RemoveInput { + /** the digest (for a bundle, archive or copied base) */ + "digest"?: string; + /** the name */ + "name": string; + /** why it goes */ + "reason": "tag-gone" | "retention"; + /** the tag (for a tagged version) */ + "tag"?: string; + /** the version */ + "version"?: string; +} + +/** is what remove answers. */ +export interface RemoveAnswer { + "artifact"?: Artifact; + /** it is gone */ + "removed": boolean; +} + +/** is the body of the event published. */ +export type PublishedEvent = Outcome; + +/** is the body of the event refused. */ +export type RefusedEvent = Outcome; + +/** is the body of the event removed. */ +export type RemovedEvent = Outcome; + diff --git a/ts/seats/ociartifactregistry/tsconfig.json b/ts/seats/ociartifactregistry/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/ociartifactregistry/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/seats/operatorchannel/package.json b/ts/seats/operatorchannel/package.json new file mode 100644 index 0000000..e1d9bcb --- /dev/null +++ b/ts/seats/operatorchannel/package.json @@ -0,0 +1,19 @@ +{ + "description": "The contract of the seat operator-channel, generated from its definition.", + "devDependencies": { + "typescript": "^5.6.0" + }, + "exports": { + ".": "./dist/index.js" + }, + "files": [ + "dist" + ], + "name": "@novox/mesh-contracts-operator-channel", + "scripts": { + "build": "tsc", + "prepare": "tsc" + }, + "type": "module", + "version": "0.1.0" +} diff --git a/ts/src/operator-channel.ts b/ts/seats/operatorchannel/src/index.ts similarity index 100% rename from ts/src/operator-channel.ts rename to ts/seats/operatorchannel/src/index.ts diff --git a/ts/seats/operatorchannel/tsconfig.json b/ts/seats/operatorchannel/tsconfig.json new file mode 100644 index 0000000..c610421 --- /dev/null +++ b/ts/seats/operatorchannel/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"] +} diff --git a/ts/src/index.ts b/ts/src/index.ts index 18984e2..6df2ae8 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -1,12 +1,3 @@ // Code generated by seatgen from the seat definitions; DO NOT EDIT. export * as seats from "./seats.js"; -export * as meshBroker from "./mesh-broker.js"; -export * as meshVault from "./mesh-vault.js"; -export * as meshConfig from "./mesh-config.js"; -export * as meshDeliveryChecker from "./mesh-delivery-checker.js"; -export * as operatorChannel from "./operator-channel.js"; -export * as npmPackageRegistry from "./npm-package-registry.js"; -export * as goPackageRegistry from "./go-package-registry.js"; -export * as containerImageRegistry from "./container-image-registry.js"; -export * as ociArtifactRegistry from "./oci-artifact-registry.js";