@monosmith/plugin-sdk 0.5.0 → 0.6.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monosmith/plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The TypeScript SDK for writing smith plugins: the protocol's types, the serve loop, a test host, the conformance checks, templating and key-order-keeping JSON editing. No runtime dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -207,6 +207,17 @@ export const protocolSchema = {
|
|
|
207
207
|
},
|
|
208
208
|
"capability": "latest",
|
|
209
209
|
"notification": false
|
|
210
|
+
},
|
|
211
|
+
"sbom/components": {
|
|
212
|
+
"description": "Asks which components a project ships (its locked dependencies, read from a lockfile where the ecosystem has one and from the manifest otherwise), as package URLs, for the SBOM a release attaches.",
|
|
213
|
+
"params": {
|
|
214
|
+
"$ref": "#/$defs/ComponentsParams"
|
|
215
|
+
},
|
|
216
|
+
"result": {
|
|
217
|
+
"$ref": "#/$defs/ComponentsResult"
|
|
218
|
+
},
|
|
219
|
+
"capability": "components",
|
|
220
|
+
"notification": false
|
|
210
221
|
}
|
|
211
222
|
},
|
|
212
223
|
"x-errorCodes": [
|
|
@@ -531,6 +542,10 @@ export const protocolSchema = {
|
|
|
531
542
|
"cancel": {
|
|
532
543
|
"type": "boolean",
|
|
533
544
|
"description": "Cancel says the plugin stops the work of a request when the host sends a cancel notification with its id, then answers that request with its result (if the work was already done) or the request-cancelled error. A host never sends the notification to a plugin without it."
|
|
545
|
+
},
|
|
546
|
+
"components": {
|
|
547
|
+
"type": "boolean",
|
|
548
|
+
"description": "Components lists a project's dependencies for its SBOM."
|
|
534
549
|
}
|
|
535
550
|
}
|
|
536
551
|
},
|
|
@@ -588,6 +603,62 @@ export const protocolSchema = {
|
|
|
588
603
|
}
|
|
589
604
|
}
|
|
590
605
|
},
|
|
606
|
+
"Component": {
|
|
607
|
+
"description": "Component is one dependency of a project.",
|
|
608
|
+
"type": "object",
|
|
609
|
+
"properties": {
|
|
610
|
+
"name": {
|
|
611
|
+
"type": "string"
|
|
612
|
+
},
|
|
613
|
+
"version": {
|
|
614
|
+
"type": "string",
|
|
615
|
+
"description": "Version is the locked version, or the declared range when the project has no lockfile."
|
|
616
|
+
},
|
|
617
|
+
"purl": {
|
|
618
|
+
"type": "string",
|
|
619
|
+
"description": "PURL is the package URL (https://github.com/package-url/purl-spec)."
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
"required": [
|
|
623
|
+
"name",
|
|
624
|
+
"purl"
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
"ComponentsParams": {
|
|
628
|
+
"description": "ComponentsParams asks a plugin for the components one of its projects ships: what a CycloneDX SBOM lists.",
|
|
629
|
+
"type": "object",
|
|
630
|
+
"properties": {
|
|
631
|
+
"project": {
|
|
632
|
+
"$ref": "#/$defs/Project"
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
"required": [
|
|
636
|
+
"project"
|
|
637
|
+
]
|
|
638
|
+
},
|
|
639
|
+
"ComponentsResult": {
|
|
640
|
+
"description": "ComponentsResult lists the components, read from a lockfile where the ecosystem has one and from the manifest otherwise. An empty list is an answer: the project declares no dependencies.",
|
|
641
|
+
"type": "object",
|
|
642
|
+
"properties": {
|
|
643
|
+
"components": {
|
|
644
|
+
"type": "array",
|
|
645
|
+
"items": {
|
|
646
|
+
"$ref": "#/$defs/Component"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
"source": {
|
|
650
|
+
"type": "string",
|
|
651
|
+
"description": "Source is the workspace-relative file the list was read from, \"\" when the project has none."
|
|
652
|
+
},
|
|
653
|
+
"purl": {
|
|
654
|
+
"type": "string",
|
|
655
|
+
"description": "PURL is the project's own package URL when it has a registry identity (without a version: the release supplies it); \"\" otherwise."
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
"required": [
|
|
659
|
+
"components"
|
|
660
|
+
]
|
|
661
|
+
},
|
|
591
662
|
"ContributeParams": {
|
|
592
663
|
"description": "ContributeParams hands a plugin the projects it applies to: those whose stack includes it, or, for a workspace-wide convention, those of the languages it supports that smith.toml enables it for.",
|
|
593
664
|
"type": "object",
|
|
@@ -160,6 +160,8 @@ export interface Capabilities {
|
|
|
160
160
|
* request-cancelled error. A host never sends the notification to a plugin without it.
|
|
161
161
|
*/
|
|
162
162
|
cancel?: boolean;
|
|
163
|
+
/** Components lists a project's dependencies for its SBOM. */
|
|
164
|
+
components?: boolean;
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
165
167
|
* ChangeKindParams asks a plugin what changing a project's kind edits. The plugin writes nothing:
|
|
@@ -203,6 +205,35 @@ export interface ChangeKindResult {
|
|
|
203
205
|
*/
|
|
204
206
|
warnings?: string[];
|
|
205
207
|
}
|
|
208
|
+
/** Component is one dependency of a project. */
|
|
209
|
+
export interface Component {
|
|
210
|
+
name: string;
|
|
211
|
+
/** Version is the locked version, or the declared range when the project has no lockfile. */
|
|
212
|
+
version?: string;
|
|
213
|
+
/** PURL is the package URL (https://github.com/package-url/purl-spec). */
|
|
214
|
+
purl: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* ComponentsParams asks a plugin for the components one of its projects ships: what a CycloneDX
|
|
218
|
+
* SBOM lists.
|
|
219
|
+
*/
|
|
220
|
+
export interface ComponentsParams {
|
|
221
|
+
project: Project;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* ComponentsResult lists the components, read from a lockfile where the ecosystem has one and from
|
|
225
|
+
* the manifest otherwise. An empty list is an answer: the project declares no dependencies.
|
|
226
|
+
*/
|
|
227
|
+
export interface ComponentsResult {
|
|
228
|
+
components: Component[];
|
|
229
|
+
/** Source is the workspace-relative file the list was read from, "" when the project has none. */
|
|
230
|
+
source?: string;
|
|
231
|
+
/**
|
|
232
|
+
* PURL is the project's own package URL when it has a registry identity (without a version: the
|
|
233
|
+
* release supplies it); "" otherwise.
|
|
234
|
+
*/
|
|
235
|
+
purl?: string;
|
|
236
|
+
}
|
|
206
237
|
/**
|
|
207
238
|
* ContributeParams hands a plugin the projects it applies to: those whose stack includes it, or,
|
|
208
239
|
* for a workspace-wide convention, those of the languages it supports that smith.toml enables it
|
|
@@ -1156,6 +1187,16 @@ export interface ProtocolMethods {
|
|
|
1156
1187
|
result: LatestResult;
|
|
1157
1188
|
capability: 'latest';
|
|
1158
1189
|
};
|
|
1190
|
+
/**
|
|
1191
|
+
* Asks which components a project ships (its locked dependencies, read from a lockfile where the
|
|
1192
|
+
* ecosystem has one and from the manifest otherwise), as package URLs, for the SBOM a release
|
|
1193
|
+
* attaches.
|
|
1194
|
+
*/
|
|
1195
|
+
'sbom/components': {
|
|
1196
|
+
params: ComponentsParams;
|
|
1197
|
+
result: ComponentsResult;
|
|
1198
|
+
capability: 'components';
|
|
1199
|
+
};
|
|
1159
1200
|
}
|
|
1160
1201
|
export type MethodName = keyof ProtocolMethods;
|
|
1161
1202
|
export type ParamsOf<M extends MethodName> = ProtocolMethods[M]['params'];
|
package/serve/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { serve, serveStreams } from './serve.use-case.ts';
|
|
2
2
|
export { capabilitiesOf, implementsMethod } from './capabilities-of.algorithm.ts';
|
|
3
|
-
export type { Awaitable, Cancellable, CIContributor, Contributor, DeclarationEditor, DependencyManager, Discoverer, DoctorContributor, Generator, KindChanger, LatestReader, Plugin, PluginDescription, Publisher, RegistryReader, Remover, SmithPlugin, Versioner, } from './plugin.contract.ts';
|
|
3
|
+
export type { Awaitable, Cancellable, CIContributor, ComponentLister, Contributor, DeclarationEditor, DependencyManager, Discoverer, DoctorContributor, Generator, KindChanger, LatestReader, Plugin, PluginDescription, Publisher, RegistryReader, Remover, SmithPlugin, Versioner, } from './plugin.contract.ts';
|
|
4
4
|
export type { FrameSink, ServeStreams } from './protocol-streams.contract.ts';
|
|
@@ -23,4 +23,5 @@ export const PLUGIN_MEMBERS = {
|
|
|
23
23
|
'dependencies/declared': { member: 'declared', requires: ['declared', 'rewrite'] },
|
|
24
24
|
'dependencies/rewrite': { member: 'rewrite', requires: ['declared', 'rewrite'] },
|
|
25
25
|
'dependencies/latest': { member: 'latest', requires: ['latest'] },
|
|
26
|
+
'sbom/components': { member: 'components', requires: ['components'] },
|
|
26
27
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChangeKindParams, ChangeKindResult, CIParams, CIResult, ContributeParams, ContributeResult, DeclaredParams, DeclaredResult, DependencyResult, DiscoverParams, DiscoverResult, DoctorParams, DoctorResult, GenerateParams, GenerateResult, InitializeParams, InitializeResult, InstallParams, LatestParams, LatestResult, PublishedParams, PublishedResult, PublishParams, PublishResult, RemoveParams, RemoveResult, RewriteParams, UninstallParams, VersionParams, VersionResult } from '../protocol/index.ts';
|
|
1
|
+
import type { ChangeKindParams, ChangeKindResult, CIParams, CIResult, ComponentsParams, ComponentsResult, ContributeParams, ContributeResult, DeclaredParams, DeclaredResult, DependencyResult, DiscoverParams, DiscoverResult, DoctorParams, DoctorResult, GenerateParams, GenerateResult, InitializeParams, InitializeResult, InstallParams, LatestParams, LatestResult, PublishedParams, PublishedResult, PublishParams, PublishResult, RemoveParams, RemoveResult, RewriteParams, UninstallParams, VersionParams, VersionResult } from '../protocol/index.ts';
|
|
2
2
|
/** A result now or later: every method of a plugin may be `async`. */
|
|
3
3
|
export type Awaitable<T> = T | Promise<T>;
|
|
4
4
|
/** What a plugin says about itself. The serve loop fills in `protocolVersion` and `capabilities`. */
|
|
@@ -44,6 +44,10 @@ export interface Remover {
|
|
|
44
44
|
export interface KindChanger {
|
|
45
45
|
changeKind: (params: ChangeKindParams, signal: AbortSignal) => Awaitable<ChangeKindResult>;
|
|
46
46
|
}
|
|
47
|
+
/** `sbom/components`: the components a project ships, for the SBOM a release attaches. */
|
|
48
|
+
export interface ComponentLister {
|
|
49
|
+
components: (params: ComponentsParams, signal: AbortSignal) => Awaitable<ComponentsResult>;
|
|
50
|
+
}
|
|
47
51
|
/** `dependencies/install` and `dependencies/uninstall`: both, or the capability is not advertised. */
|
|
48
52
|
export interface DependencyManager {
|
|
49
53
|
install: (params: InstallParams, signal: AbortSignal) => Awaitable<DependencyResult>;
|
|
@@ -81,4 +85,4 @@ export interface Cancellable {
|
|
|
81
85
|
* from `cancellable`. How many requests it can work on at once is declared in
|
|
82
86
|
* `describe`'s `concurrency`: omit it for one at a time, in order.
|
|
83
87
|
*/
|
|
84
|
-
export type SmithPlugin = Plugin & Partial<Discoverer & Generator & Versioner & Publisher & RegistryReader & CIContributor & DoctorContributor & Remover & KindChanger & DependencyManager & DeclarationEditor & LatestReader & Contributor & Cancellable>;
|
|
88
|
+
export type SmithPlugin = Plugin & Partial<Discoverer & Generator & Versioner & Publisher & RegistryReader & CIContributor & DoctorContributor & Remover & KindChanger & ComponentLister & DependencyManager & DeclarationEditor & LatestReader & Contributor & Cancellable>;
|